diff --git a/spotless.eclipseformat.xml b/spotless.eclipseformat.xml index b851fb145..12f80cc79 100644 --- a/spotless.eclipseformat.xml +++ b/spotless.eclipseformat.xml @@ -4,7 +4,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -226,7 +226,7 @@ - + @@ -240,7 +240,7 @@ - + diff --git a/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java b/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java index 268df70b9..a67378725 100644 --- a/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java +++ b/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java @@ -115,7 +115,9 @@ public void onConstruction(FMLConstructionEvent event) { ReloadableRegistryManager.init(); try { sandbox = new GroovyScriptSandbox(scriptPath, FileUtil.makeFile(FileUtil.getMinecraftHome(), "cache", "groovy")); - } catch (MalformedURLException e) { + } catch ( + MalformedURLException e + ) { throw new IllegalStateException("Error initializing sandbox!"); } ModSupport.INSTANCE.setup(event.getASMHarvestedData()); @@ -156,7 +158,9 @@ public static void initializeRunConfig(File minecraftHome) { } try { scriptPath = scriptPath.getCanonicalFile(); - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyLog.get().error("Failed to canonicalize groovy script path '" + scriptPath + "'!"); GroovyLog.get().exception(e); } @@ -213,49 +217,67 @@ public void onServerLoad(FMLServerStartingEvent event) { @SubscribeEvent public static void onInput(InputEvent.KeyInputEvent event) { long time = Minecraft.getSystemTime(); - if (Minecraft.getMinecraft().isIntegratedServerRunning() && reloadKey - .isPressed() && time - timeSinceLastUse >= 1000 && Minecraft.getMinecraft().player.getPermissionLevel() >= 4) { + if ( + Minecraft.getMinecraft().isIntegratedServerRunning() && reloadKey + .isPressed() && time - timeSinceLastUse >= 1000 && Minecraft.getMinecraft().player.getPermissionLevel() >= 4 + ) { NetworkHandler.sendToServer(new CReload()); timeSinceLastUse = time; } } @NotNull - public static String getScriptPath() { return getScriptFile().getPath(); } + public static String getScriptPath() { + return getScriptFile().getPath(); + } @NotNull public static File getMinecraftHome() { - if (minecraftHome == null) { throw new IllegalStateException("GroovyScript is not yet loaded!"); } + if (minecraftHome == null) { + throw new IllegalStateException("GroovyScript is not yet loaded!"); + } return minecraftHome; } @NotNull public static File getScriptFile() { - if (scriptPath == null) { throw new IllegalStateException("GroovyScript is not yet loaded!"); } + if (scriptPath == null) { + throw new IllegalStateException("GroovyScript is not yet loaded!"); + } return scriptPath; } @NotNull public static File getResourcesFile() { - if (resourcesFile == null) { throw new IllegalStateException("GroovyScript is not yet loaded!"); } + if (resourcesFile == null) { + throw new IllegalStateException("GroovyScript is not yet loaded!"); + } return resourcesFile; } @NotNull public static File getRunConfigFile() { - if (runConfigFile == null) { throw new IllegalStateException("GroovyScript is not yet loaded!"); } + if (runConfigFile == null) { + throw new IllegalStateException("GroovyScript is not yet loaded!"); + } return runConfigFile; } @NotNull public static GroovyScriptSandbox getSandbox() { - if (sandbox == null) { throw new IllegalStateException("GroovyScript is not yet loaded!"); } + if (sandbox == null) { + throw new IllegalStateException("GroovyScript is not yet loaded!"); + } return sandbox; } - public static boolean isSandboxLoaded() { return sandbox != null; } + public static boolean isSandboxLoaded() { + return sandbox != null; + } - public static RunConfig getRunConfig() { return runConfig; } + public static RunConfig getRunConfig() { + return runConfig; + } @ApiStatus.Internal public static void reloadRunConfig(boolean init) { @@ -281,7 +303,9 @@ private static RunConfig createRunConfig(JsonObject json) { main.getParentFile().mkdirs(); Files.write(main.toPath(), "\nprintln('Hello World!')\n".getBytes(StandardCharsets.UTF_8), StandardOpenOption.CREATE, StandardOpenOption.WRITE); - } catch (IOException e) { + } catch ( + IOException e + ) { throw new RuntimeException(e); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/GroovyPlugin.java b/src/main/java/com/cleanroommc/groovyscript/api/GroovyPlugin.java index 77538dfff..b1b294afa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/GroovyPlugin.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/GroovyPlugin.java @@ -35,5 +35,7 @@ public interface GroovyPlugin extends IGroovyContainer { * This method exist because of the extended interface. It has no use in this interface. */ @Override @ApiStatus.NonExtendable - default boolean isLoaded() { return true; } + default boolean isLoaded() { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IGameObjectParser.java b/src/main/java/com/cleanroommc/groovyscript/api/IGameObjectParser.java index c3a437efd..3ce3ed013 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IGameObjectParser.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IGameObjectParser.java @@ -47,7 +47,9 @@ static IGameObjectParser wrapStringGetter(Function getter) { static IGameObjectParser wrapStringGetter(Function getter, boolean isUpperCase) { return (s, args) -> { - if (args.length > 0) { return Result.error("extra arguments are not allowed"); } + if (args.length > 0) { + return Result.error("extra arguments are not allowed"); + } T t = getter.apply(isUpperCase ? s.toUpperCase(Locale.ROOT) : s); return t == null ? Result.error() : Result.some(t); }; @@ -60,7 +62,9 @@ static IGameObjectParser wrapStringGetter(Function getter, static IGameObjectParser wrapStringGetter(Function getter, Function trueTypeFunction, boolean isUpperCase) { return (s, args) -> { - if (args.length > 0) { return Result.error("extra arguments are not allowed"); } + if (args.length > 0) { + return Result.error("extra arguments are not allowed"); + } V v = getter.apply(isUpperCase ? s.toUpperCase(Locale.ROOT) : s); return v == null ? Result.error() : Result.some(trueTypeFunction.apply(v)); }; diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IGroovyContainer.java b/src/main/java/com/cleanroommc/groovyscript/api/IGroovyContainer.java index 04ea10284..92ed3e736 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IGroovyContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IGroovyContainer.java @@ -49,7 +49,9 @@ public interface IGroovyContainer { * @return aliases */ @NotNull - default Collection getAliases() { return Collections.singletonList(getModId()); } + default Collection getAliases() { + return Collections.singletonList(getModId()); + } /** * Called before scripts are executed for the first time. Called right before @@ -71,7 +73,9 @@ public interface IGroovyContainer { * @see Priority */ @NotNull - default Priority getOverridePriority() { return Priority.NONE; } + default Priority getOverridePriority() { + return Priority.NONE; + } enum Priority { /** diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java b/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java index a2fda84dc..19a22d6c3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java @@ -23,7 +23,9 @@ public interface IIngredient extends IResourceStack, Predicate { ItemStack[] getMatchingStacks(); - default boolean isEmpty() { return getAmount() <= 0 || getMatchingStacks().length == 0; } + default boolean isEmpty() { + return getAmount() <= 0 || getMatchingStacks().length == 0; + } default ItemStack applyTransform(ItemStack matchedInput) { return ForgeHooks.getContainerItem(matchedInput); @@ -61,17 +63,20 @@ default IIngredient withAmount(int amount) { /** * An empty ingredient with stack size 0, that matches empty item stacks */ - IIngredient EMPTY = new IIngredient() - { + IIngredient EMPTY = new IIngredient() { @Override - public int getAmount() { return 0; } + public int getAmount() { + return 0; + } @Override public void setAmount(int amount) {} @Override - public boolean isEmpty() { return true; } + public boolean isEmpty() { + return true; + } @Override public IIngredient exactCopy() { @@ -84,7 +89,9 @@ public Ingredient toMcIngredient() { } @Override - public ItemStack[] getMatchingStacks() { return new ItemStack[]{ItemStack.EMPTY}; } + public ItemStack[] getMatchingStacks() { + return new ItemStack[]{ItemStack.EMPTY}; + } @Override public boolean test(ItemStack stack) { @@ -95,8 +102,7 @@ public boolean test(ItemStack stack) { /** * An ingredient with stack size 1, that matches any item stack */ - IIngredient ANY = new IIngredient() - { + IIngredient ANY = new IIngredient() { @Override public IIngredient exactCopy() { @@ -105,8 +111,7 @@ public IIngredient exactCopy() { @Override public Ingredient toMcIngredient() { - return new Ingredient() - { + return new Ingredient() { @Override public boolean apply(@Nullable ItemStack p_apply_1_) { @@ -116,13 +121,19 @@ public boolean apply(@Nullable ItemStack p_apply_1_) { } @Override - public ItemStack[] getMatchingStacks() { return new ItemStack[0]; } + public ItemStack[] getMatchingStacks() { + return new ItemStack[0]; + } @Override - public boolean isEmpty() { return false; } + public boolean isEmpty() { + return false; + } @Override - public int getAmount() { return 1; } + public int getAmount() { + return 1; + } @Override public void setAmount(int amount) {} diff --git a/src/main/java/com/cleanroommc/groovyscript/api/INamed.java b/src/main/java/com/cleanroommc/groovyscript/api/INamed.java index de3e0a8a3..56007cbc7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/INamed.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/INamed.java @@ -8,11 +8,15 @@ public interface INamed { default String getName() { Collection aliases = getAliases(); - if (aliases.isEmpty()) { return "EmptyName"; } + if (aliases.isEmpty()) { + return "EmptyName"; + } return aliases.iterator().next(); } @GroovyBlacklist - default boolean isEnabled() { return true; } + default boolean isEnabled() { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IObjectParser.java b/src/main/java/com/cleanroommc/groovyscript/api/IObjectParser.java index 2db7e36ac..4cf29ddfb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IObjectParser.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IObjectParser.java @@ -59,7 +59,9 @@ static IObjectParser wrapStringGetter(Function getter) { static IObjectParser wrapStringGetter(Function getter, boolean isUpperCase) { return (s, args) -> { - if (args.length > 0) { return Result.error("extra arguments are not allowed"); } + if (args.length > 0) { + return Result.error("extra arguments are not allowed"); + } T t = getter.apply(isUpperCase ? s.toUpperCase(Locale.ROOT) : s); return t == null ? Result.error() : Result.some(t); }; @@ -72,7 +74,9 @@ static IObjectParser wrapStringGetter(Function getter, Func static IObjectParser wrapStringGetter(Function getter, Function trueTypeFunction, boolean isUpperCase) { return (s, args) -> { - if (args.length > 0) { return Result.error("extra arguments are not allowed"); } + if (args.length > 0) { + return Result.error("extra arguments are not allowed"); + } V v = getter.apply(isUpperCase ? s.toUpperCase(Locale.ROOT) : s); return v == null ? Result.error() : Result.some(trueTypeFunction.apply(v)); }; diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IRegistrar.java b/src/main/java/com/cleanroommc/groovyscript/api/IRegistrar.java index 40dba81a9..0765c9c6c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IRegistrar.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IRegistrar.java @@ -39,13 +39,17 @@ default void addFieldsOf(Object object) { } for (Field field : clazz.getDeclaredFields()) { boolean isStatic = Modifier.isStatic(field.getModifiers()); - if (!field.isAnnotationPresent(GroovyBlacklist.class) && INamed.class.isAssignableFrom(field.getType()) && (!staticOnly || isStatic) && field.isAccessible()) { + if ( + !field.isAnnotationPresent(GroovyBlacklist.class) && INamed.class.isAssignableFrom(field.getType()) && (!staticOnly || isStatic) && field.isAccessible() + ) { try { Object o = field.get(isStatic ? null : object); if (o != null) { addRegistry((INamed) o); } - } catch (IllegalAccessException e) { + } catch ( + IllegalAccessException e + ) { GroovyLog.get().errorMC("Failed to register {} as virtualized registry", field.getName()); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/Result.java b/src/main/java/com/cleanroommc/groovyscript/api/Result.java index 6c749113c..5f9fdcaf4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/Result.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/Result.java @@ -50,10 +50,14 @@ public boolean hasError() { } @Override - public @Nullable String getError() { return null; } + public @Nullable String getError() { + return null; + } @Override - public @NotNull T getValue() { return this.value; } + public @NotNull T getValue() { + return this.value; + } } class Error implements Result { @@ -70,7 +74,9 @@ public boolean hasError() { } @Override - public @Nullable String getError() { return this.error; } + public @Nullable String getError() { + return this.error; + } @Override public @NotNull T getValue() { diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Comp.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Comp.java index 966673d8d..71d6e508c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Comp.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Comp.java @@ -78,9 +78,13 @@ enum Type { this.key = baseLocalizationPath + key; } - public String getSymbol() { return symbol; } + public String getSymbol() { + return symbol; + } - public String getKey() { return key; } + public String getKey() { + return key; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java index 3177a2239..789c32555 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RegistryDescription.java @@ -151,7 +151,9 @@ enum Reloadability { */ DISABLED; - public boolean isReloadable() { return this != DISABLED; } + public boolean isReloadable() { + return this != DISABLED; + } public boolean hasFlaws() { return this == FLAWED; diff --git a/src/main/java/com/cleanroommc/groovyscript/command/CustomClickAction.java b/src/main/java/com/cleanroommc/groovyscript/command/CustomClickAction.java index 6dfdd02e4..5f889b88e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/CustomClickAction.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/CustomClickAction.java @@ -21,7 +21,9 @@ public static ClickEvent makeCopyEvent(String value) { } public static void registerAction(String name, Consumer action) { - if (ACTIONS.containsKey(name)) { throw new IllegalArgumentException("Action " + name + " already exists!"); } + if (ACTIONS.containsKey(name)) { + throw new IllegalArgumentException("Action " + name + " already exists!"); + } ACTIONS.put(name, action); } @@ -29,7 +31,9 @@ public static boolean runActionHook(String fullId) { String[] parts = fullId.split("::", 2); if (parts.length < 2) return false; Consumer action = ACTIONS.get(parts[0]); - if (action == null) { return false; } + if (action == null) { + return false; + } action.accept(parts[1]); return true; } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java index 5aee038f1..bae156599 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java @@ -214,10 +214,14 @@ public GSCommand() { } @Override @Nonnull - public String getName() { return "groovyscript"; } + public String getName() { + return "groovyscript"; + } @Override @Nonnull - public List getAliases() { return Arrays.asList("grs", "GroovyScript", "gs"); } + public List getAliases() { + return Arrays.asList("grs", "GroovyScript", "gs"); + } @Override @Nonnull public String getUsage(@NotNull ICommandSender sender) { @@ -246,7 +250,9 @@ private static BlockPos getBlockLookingAt(EntityPlayer player) { Vec3d end = eyes.add(look.x * distance, look.y * distance, look.z * distance); RayTraceResult result = player.getEntityWorld().rayTraceBlocks(eyes, end, true); - if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) { return result.getBlockPos(); } + if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) { + return result.getBlockPos(); + } return null; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/GSMekanismCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/GSMekanismCommand.java index 25dcc91e2..ce0d1734e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/GSMekanismCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/GSMekanismCommand.java @@ -50,7 +50,9 @@ public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sen } @Override - public @NotNull String getName() { return "mekanism"; } + public @NotNull String getName() { + return "mekanism"; + } @Override public @NotNull String getUsage(@NotNull ICommandSender sender) { @@ -58,5 +60,7 @@ public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sen } @Override - public @NotNull List getAliases() { return Collections.singletonList("mek"); } + public @NotNull List getAliases() { + return Collections.singletonList("mek"); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/PackmodeCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/PackmodeCommand.java index b43a3d281..337415db1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/PackmodeCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/PackmodeCommand.java @@ -20,7 +20,9 @@ public class PackmodeCommand extends CommandBase { @Override - public @NotNull String getName() { return "packmode"; } + public @NotNull String getName() { + return "packmode"; + } @Override public @NotNull String getUsage(@NotNull ICommandSender sender) { diff --git a/src/main/java/com/cleanroommc/groovyscript/command/SimpleCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/SimpleCommand.java index 234f2b27a..fe8028b76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/SimpleCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/SimpleCommand.java @@ -30,7 +30,9 @@ public SimpleCommand(String name, ICommand command, String... aliases) { } @Override - public @NotNull String getName() { return name; } + public @NotNull String getName() { + return name; + } @Override public @NotNull String getUsage(@NotNull ICommandSender sender) { @@ -49,5 +51,7 @@ public interface ICommand { } @Override - public @NotNull List getAliases() { return aliases; } + public @NotNull List getAliases() { + return aliases; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java index ddc95a293..5b20c3152 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java @@ -61,8 +61,7 @@ public GroovyFluid.Builder createFluid(String name) { } public CreativeTabs createCreativeTab(String name, ItemStack icon) { - return new CreativeTabs(name) - { + return new CreativeTabs(name) { @Override public @NotNull ItemStack createIcon() { @@ -75,7 +74,11 @@ public CreativeTabs createCreativeTab(String name, Item icon) { return createCreativeTab(name, new ItemStack(icon)); } - public CreativeTabs getDefaultTab() { return defaultTab; } + public CreativeTabs getDefaultTab() { + return defaultTab; + } - public void setDefaultCreativeTab(CreativeTabs tab) { this.defaultTab = tab; } + public void setDefaultCreativeTab(CreativeTabs tab) { + this.defaultTab = tab; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java index ad6686b09..b0bc45e7a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyItem.java @@ -105,7 +105,9 @@ public GroovyItem register() { } @Override - public int getItemEnchantability() { return this.enchantability; } + public int getItemEnchantability() { + return this.enchantability; + } @Override public boolean hasEffect(@NotNull ItemStack stack) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java index 1d2f07e81..bcfdefa3f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java @@ -29,7 +29,9 @@ public GroovyResourcePack() { } @Override - public @NotNull BufferedImage getPackImage() throws IOException { return null; } + public @NotNull BufferedImage getPackImage() throws IOException { + return null; + } @Override public T getPackMetadata(@NotNull MetadataSerializer metadataSerializer, @@ -38,5 +40,7 @@ public T getPackMetadata(@NotNull MetadataSerialize } @Override - public @NotNull String getPackName() { return "GroovyScriptResources"; } + public @NotNull String getPackName() { + return "GroovyScriptResources"; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java index c77d064e6..837ab7745 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Burning.java @@ -78,11 +78,17 @@ public BurningRecipe(IIngredient input, ItemStack output, int ticks, Closure startCondition) { } @Override - public String getErrorMsg() { return "Error adding in world burning recipe"; } + public String getErrorMsg() { + return "Error adding in world burning recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java index be884021c..e40741baa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java @@ -73,11 +73,17 @@ public ExplosionRecipe(IIngredient input, ItemStack output, float chance, Closur this.startCondition = startCondition; } - public IIngredient getInput() { return input; } + public IIngredient getInput() { + return input; + } - public ItemStack getOutput() { return output; } + public ItemStack getOutput() { + return output; + } - public float getChance() { return chance; } + public float getChance() { + return chance; + } private boolean tryRecipe(EntityItem entityItem, ItemStack itemStack) { if (!this.input.test(itemStack)) return false; @@ -126,7 +132,9 @@ public RecipeBuilder startCondition(Closure startCondition) { } @Override - public String getErrorMsg() { return "Error adding in world explosion recipe"; } + public String getErrorMsg() { + return "Error adding in world explosion recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -152,7 +160,9 @@ public void validate(GroovyLog.Msg msg) { public void findAndRunRecipe(EntityItem entityItem) { ItemStack itemStack = entityItem.getItem(); for (ExplosionRecipe explosionRecipe : this.explosionRecipes) { - if (explosionRecipe.tryRecipe(entityItem, itemStack)) { return; } + if (explosionRecipe.tryRecipe(entityItem, itemStack)) { + return; + } } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java index 45c86da5d..acef48059 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidRecipe.java @@ -53,7 +53,9 @@ public static void add(FluidRecipe fluidRecipe) { public static boolean remove(FluidRecipe fluidRecipe) { List fluidRecipes1 = fluidRecipes.get(fluidRecipe.input.getName()); - if (fluidRecipes1 != null) { return fluidRecipes1.remove(fluidRecipe); } + if (fluidRecipes1 != null) { + return fluidRecipes1.remove(fluidRecipe); + } return false; } @@ -118,7 +120,9 @@ public static boolean findAndRunRecipe(Fluid fluid, World world, BlockPos pos, I } // search for a recipe using those items for (FluidRecipe recipe : candidates) { - if (recipe.tryRecipe(world, pos, itemsInFluid)) { return true; } + if (recipe.tryRecipe(world, pos, itemsInFluid)) { + return true; + } } return false; } @@ -138,11 +142,17 @@ public FluidRecipe(Fluid input, IIngredient[] itemInputs, float[] itemConsumeCha this.afterRecipe = afterRecipe; } - public Fluid getFluidInput() { return input; } + public Fluid getFluidInput() { + return input; + } - public IIngredient[] getItemInputs() { return itemInputs; } + public IIngredient[] getItemInputs() { + return itemInputs; + } - public float[] getItemConsumeChance() { return itemConsumeChance; } + public float[] getItemConsumeChance() { + return itemConsumeChance; + } @Optional.Method(modid = "jei") public abstract void setJeiOutput(IIngredients ingredients); @@ -202,7 +212,9 @@ private boolean tryRecipe(World world, BlockPos pos, List itemsIn } return false; } - if (this.startCondition != null && !ClosureHelper.call(true, this.startCondition, world, pos)) { return false; } + if (this.startCondition != null && !ClosureHelper.call(true, this.startCondition, world, pos)) { + return false; + } // kill all items with the before calculated amount itemsInFluid.forEach(ItemContainer::killItems); // handle the output of the recipe @@ -225,10 +237,16 @@ private boolean tryRecipe(World world, BlockPos pos, List itemsIn public static Fluid getFluid(IBlockState state) { Block block = state.getBlock(); - if (block instanceof IFluidBlock) { return ((IFluidBlock) block).getFluid(); } + if (block instanceof IFluidBlock) { + return ((IFluidBlock) block).getFluid(); + } if (block instanceof BlockLiquid) { - if (state.getMaterial() == Material.WATER) { return FluidRegistry.WATER; } - if (state.getMaterial() == Material.LAVA) { return FluidRegistry.LAVA; } + if (state.getMaterial() == Material.WATER) { + return FluidRegistry.WATER; + } + if (state.getMaterial() == Material.LAVA) { + return FluidRegistry.LAVA; + } } return null; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java index 0d3984892..ed5c19e6f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java @@ -47,8 +47,10 @@ public boolean removeByInput(FluidStack fluid) { GroovyLog.msg("Error removing in world fluid to block recipe").add("input fluid must not be empty").error().post(); return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to block recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -58,16 +60,20 @@ public boolean removeByInput(FluidStack fluid) { } public boolean removeByInput(FluidStack fluid, ItemStack... input) { - if (GroovyLog.msg("Error removing in world fluid to block recipe").add(IngredientHelper.isEmpty(fluid), + if ( + GroovyLog.msg("Error removing in world fluid to block recipe").add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty").add( IngredientHelper.isEmpty(input), () -> "input ingredients must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( input), - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to block recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -99,7 +105,9 @@ public Recipe(Fluid input, IIngredient[] itemInputs, float[] itemConsumeChance, this.output = output; } - public IBlockState getOutput() { return output; } + public IBlockState getOutput() { + return output; + } @Override public void setJeiOutput(IIngredients ingredients) { @@ -127,7 +135,9 @@ public RecipeBuilder output(Block block) { } @Override - public String getErrorMsg() { return "Error adding in world fluid to block recipe"; } + public String getErrorMsg() { + return "Error adding in world fluid to block recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java index 036b10b52..40720e255 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java @@ -45,8 +45,10 @@ public boolean removeByInput(FluidStack fluid) { GroovyLog.msg("Error removing in world fluid to fluid recipe").add("input fluid must not be empty").error().post(); return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to fluid recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -56,16 +58,20 @@ public boolean removeByInput(FluidStack fluid) { } public boolean removeByInput(FluidStack fluid, ItemStack... input) { - if (GroovyLog.msg("Error removing in world fluid to fluid recipe").add(IngredientHelper.isEmpty(fluid), + if ( + GroovyLog.msg("Error removing in world fluid to fluid recipe").add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty").add( IngredientHelper.isEmpty(input), () -> "input ingredients must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( input), - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to fluid recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -97,7 +103,9 @@ public Recipe(Fluid input, IIngredient[] itemInputs, float[] itemConsumeChance, this.output = output; } - public Fluid getOutput() { return output; } + public Fluid getOutput() { + return output; + } @Override public void setJeiOutput(IIngredients ingredients) { @@ -113,7 +121,9 @@ public void handleRecipeResult(World world, BlockPos pos) { public static class RecipeBuilder extends FluidRecipe.RecipeBuilder { @Override - public String getErrorMsg() { return "Error adding in world fluid to fluid recipe"; } + public String getErrorMsg() { + return "Error adding in world fluid to fluid recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java index bfad67b3b..95d0cbcc9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java @@ -47,8 +47,10 @@ public boolean removeByInput(FluidStack fluid) { GroovyLog.msg("Error removing in world fluid to item recipe").add("input fluid must not be empty").error().post(); return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class, + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to item recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -58,16 +60,20 @@ public boolean removeByInput(FluidStack fluid) { } public boolean removeByInput(FluidStack fluid, ItemStack... input) { - if (GroovyLog.msg("Error removing in world fluid to item recipe").add(IngredientHelper.isEmpty(fluid), + if ( + GroovyLog.msg("Error removing in world fluid to item recipe").add(IngredientHelper.isEmpty(fluid), () -> "input fluid must not be empty").add( IngredientHelper.isEmpty(input), () -> "input ingredients must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return false; } - if (!FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( + if ( + !FluidRecipe.removeIf(fluid.getFluid(), fluidRecipe -> fluidRecipe.getClass() == Recipe.class && fluidRecipe.matches( input), - fluidRecipe -> addBackup((Recipe) fluidRecipe))) { + fluidRecipe -> addBackup((Recipe) fluidRecipe)) + ) { GroovyLog.msg("Error removing in world fluid to item recipe").add("no recipes found for {}", fluid.getFluid() .getName()).error() .post(); @@ -101,9 +107,13 @@ public Recipe(Fluid input, IIngredient[] itemInputs, float[] itemConsumeChance, this.fluidConsumptionChance = fluidConsumptionChance; } - public ItemStack getOutput() { return output; } + public ItemStack getOutput() { + return output; + } - public float getFluidConsumptionChance() { return fluidConsumptionChance; } + public float getFluidConsumptionChance() { + return fluidConsumptionChance; + } @Override public void setJeiOutput(IIngredients ingredients) { @@ -112,7 +122,9 @@ public void setJeiOutput(IIngredients ingredients) { @Override public void handleRecipeResult(World world, BlockPos pos) { - if (this.fluidConsumptionChance > 0 && (this.fluidConsumptionChance >= 1 || GroovyScript.RND.nextFloat() <= this.fluidConsumptionChance)) { + if ( + this.fluidConsumptionChance > 0 && (this.fluidConsumptionChance >= 1 || GroovyScript.RND.nextFloat() <= this.fluidConsumptionChance) + ) { world.setBlockToAir(pos); } InWorldCrafting.spawnItem(world, pos, getOutput().copy()); @@ -134,7 +146,9 @@ public RecipeBuilder fluidConsumptionChance(float fluidConsumptionChance) { } @Override - public String getErrorMsg() { return "Error adding in world fluid to item recipe"; } + public String getErrorMsg() { + return "Error adding in world fluid to item recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java index db177795d..d71ecbcf0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/PistonPush.java @@ -73,19 +73,29 @@ public PistonPushRecipe(IIngredient input, ItemStack output, int maxConversionsP this.startCondition = startCondition; } - public IIngredient getInput() { return input; } + public IIngredient getInput() { + return input; + } - public ItemStack getOutput() { return output; } + public ItemStack getOutput() { + return output; + } - public int getMaxConversionsPerPush() { return maxConversionsPerPush; } + public int getMaxConversionsPerPush() { + return maxConversionsPerPush; + } - public int getMinHarvestLevel() { return minHarvestLevel; } + public int getMinHarvestLevel() { + return minHarvestLevel; + } private boolean tryRecipe(Consumer entitySpawner, EntityItem entityItem, ItemStack itemStack, IBlockState pushingAgainst) { if (!this.input.test(itemStack)) return false; - if (this.startCondition != null && !ClosureHelper.call(true, this.startCondition, entityItem, itemStack, - pushingAgainst)) return false; + if ( + this.startCondition != null && !ClosureHelper.call(true, this.startCondition, entityItem, itemStack, + pushingAgainst) + ) return false; if (this.minHarvestLevel >= 0 && this.minHarvestLevel > pushingAgainst.getBlock().getHarvestLevel(pushingAgainst)) return false; ItemStack newStack = this.output.copy(); @@ -125,7 +135,9 @@ public RecipeBuilder startCondition(Closure beforeRecipe) { } @Override - public String getErrorMsg() { return "Error adding in world piston push recipe"; } + public String getErrorMsg() { + return "Error adding in world piston push recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -152,7 +164,9 @@ public void validate(GroovyLog.Msg msg) { public void findAndRunRecipe(Consumer entitySpawner, EntityItem entityItem, IBlockState pushingAgainst) { ItemStack itemStack = entityItem.getItem(); for (PistonPushRecipe pistonPushRecipe : this.pistonPushRecipes) { - if (pistonPushRecipe.tryRecipe(entitySpawner, entityItem, itemStack, pushingAgainst)) { return; } + if (pistonPushRecipe.tryRecipe(entitySpawner, entityItem, itemStack, pushingAgainst)) { + return; + } } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/BurningRecipeCategory.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/BurningRecipeCategory.java index b4d4ad636..1b2f8bb70 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/BurningRecipeCategory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/BurningRecipeCategory.java @@ -60,7 +60,9 @@ public void drawExtras(@NotNull Minecraft minecraft) { } @Nullable @Override - public IDrawable getIcon() { return icon; } + public IDrawable getIcon() { + return icon; + } public static class RecipeWrapper implements IRecipeWrapper { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/ExplosionRecipeCategory.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/ExplosionRecipeCategory.java index ee5c20b8b..1f23ebed5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/ExplosionRecipeCategory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/ExplosionRecipeCategory.java @@ -61,7 +61,9 @@ public void drawExtras(@NotNull Minecraft minecraft) { } @Nullable @Override - public IDrawable getIcon() { return icon; } + public IDrawable getIcon() { + return icon; + } public static class RecipeWrapper implements IRecipeWrapper { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/FluidRecipeCategory.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/FluidRecipeCategory.java index 6362e1873..eb4284283 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/FluidRecipeCategory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/FluidRecipeCategory.java @@ -108,7 +108,9 @@ public void drawExtras(@NotNull Minecraft minecraft) { } @Nullable @Override - public IDrawable getIcon() { return this.icon; } + public IDrawable getIcon() { + return this.icon; + } public static void drawLine(Minecraft minecraft, String langKey, int x, int y, int color, Object... obj) { minecraft.fontRenderer.drawSplitString(I18n.format(langKey, obj), x, y, 168, color); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/PistonPushRecipeCategory.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/PistonPushRecipeCategory.java index 93685b546..2cae71fcd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/PistonPushRecipeCategory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/PistonPushRecipeCategory.java @@ -60,7 +60,9 @@ public void drawExtras(@NotNull Minecraft minecraft) { } @Nullable @Override - public IDrawable getIcon() { return icon; } + public IDrawable getIcon() { + return icon; + } public static class RecipeWrapper implements IRecipeWrapper { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java index c21023b58..3612f8cd9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java @@ -247,7 +247,9 @@ public LootEntryBuilder setMetadata(int min, int max, LootCondition... condition public LootEntryBuilder setNBT(String tag) { try { return this.setNBT(JsonToNBT.getTagFromJson(tag), EMPTY_CONDITIONS); - } catch (NBTException e) { + } catch ( + NBTException e + ) { out.add("could not parse nbt string"); return this; } @@ -264,7 +266,9 @@ public LootEntryBuilder setNBT(NBTTagCompound tag) { public LootEntryBuilder setNBT(String tag, LootCondition... conditions) { try { return this.setNBT(JsonToNBT.getTagFromJson(tag), conditions); - } catch (NBTException e) { + } catch ( + NBTException e + ) { out.add("could not parse nbt string"); return this; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ExternalModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ExternalModContainer.java index a869e58f8..5880c7010 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ExternalModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ExternalModContainer.java @@ -36,16 +36,24 @@ public class ExternalModContainer extends GroovyContainer getAliases() { return aliases; } + public Collection getAliases() { + return aliases; + } @Override public void onCompatLoaded(GroovyContainer container) { @@ -58,5 +66,7 @@ public GroovyPropertyContainer get() { } @Override - public @NotNull GroovyPlugin.Priority getOverridePriority() { return priority; } + public @NotNull GroovyPlugin.Priority getOverridePriority() { + return priority; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyContainer.java index 8fc33176e..da999d75b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyContainer.java @@ -29,7 +29,9 @@ public String toString() { * @deprecated Use {@link #addProperty(INamed)} and {@link #addPropertiesOfFields(Object, boolean)} from this class instead. */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "1.2.0") @GroovyBlacklist - public IRegistrar getVirtualizedRegistrar() { return getRegistrar(); } + public IRegistrar getVirtualizedRegistrar() { + return getRegistrar(); + } /** * @deprecated Use {@link #addProperty(INamed)} and {@link #addPropertiesOfFields(Object, boolean)} from this class instead. diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java index eceb32fec..e9336698c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java @@ -35,10 +35,14 @@ protected void addProperty(INamed property) { } @UnmodifiableView - public Collection getRegistries() { return this.view.values(); } + public Collection getRegistries() { + return this.view.values(); + } @UnmodifiableView - public Map getProperties() { return view; } + public Map getProperties() { + return view; + } /** * Register bracket handlers, bindings, expansions etc. here @@ -57,14 +61,18 @@ protected void addPropertyFieldsOf(Object object, boolean privateToo) { } for (Field field : clazz.getDeclaredFields()) { boolean isStatic = Modifier.isStatic(field.getModifiers()); - if (!field.isAnnotationPresent(GroovyBlacklist.class) && INamed.class.isAssignableFrom(field.getType()) && (!staticOnly || isStatic) && (privateToo || (Modifier.isPublic(field.getModifiers())))) { + if ( + !field.isAnnotationPresent(GroovyBlacklist.class) && INamed.class.isAssignableFrom(field.getType()) && (!staticOnly || isStatic) && (privateToo || (Modifier.isPublic(field.getModifiers()))) + ) { try { if (!field.isAccessible()) field.setAccessible(true); Object o = field.get(isStatic ? null : object); if (o != null) { addProperty((INamed) o); } - } catch (IllegalAccessException e) { + } catch ( + IllegalAccessException e + ) { GroovyLog.get().errorMC("Failed to register {} as named property", field.getName()); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java index 3867f62f0..817a16db5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java @@ -57,10 +57,14 @@ public class InternalModContainer extends Gro } @Override - public boolean isLoaded() { return loaded; } + public boolean isLoaded() { + return loaded; + } @NotNull @Override - public Collection getAliases() { return aliases; } + public Collection getAliases() { + return aliases; + } @Override public T get() { @@ -68,10 +72,14 @@ public T get() { } @Override - public @NotNull String getModId() { return modId; } + public @NotNull String getModId() { + return modId; + } @Override - public @NotNull String getContainerName() { return containerName; } + public @NotNull String getContainerName() { + return containerName; + } @Override public void onCompatLoaded(GroovyContainer container) {} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java index 6c9414abd..4881a8bbd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java @@ -191,9 +191,13 @@ public void setup(ASMDataTable dataTable) { if (!externalPluginClasses.contains(clazz)) { registerContainer((GroovyPlugin) clazz.newInstance()); } - } catch (ClassNotFoundException | InstantiationException e) { + } catch ( + ClassNotFoundException | InstantiationException e + ) { GroovyScript.LOGGER.error("Could not initialize Groovy Plugin '{}'", data.getClassName()); - } catch (Throwable e) { + } catch ( + Throwable e + ) { throw new RuntimeException(e); } } @@ -254,7 +258,9 @@ public Object getProperty(String name) { @Deprecated - public @UnmodifiableView Map> getProperties() { return containersView; } + public @UnmodifiableView Map> getProperties() { + return containersView; + } @GroovyBlacklist @ApiStatus.Internal public static void init() { @@ -275,7 +281,9 @@ public static void init() { @NotNull public GroovyContainer getContainer(String mod) { - if (!containers.containsKey(mod)) { throw new IllegalStateException("There is no compat registered for '" + mod + "'!"); } + if (!containers.containsKey(mod)) { + throw new IllegalStateException("There is no compat registered for '" + mod + "'!"); + } return containers.get(mod); } @@ -283,5 +291,7 @@ public boolean hasCompatFor(String mod) { return containers.containsKey(mod); } - public static boolean isFrozen() { return frozen; } + public static boolean isFrozen() { + return frozen; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java index 34b581df6..05d82a666 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java @@ -106,7 +106,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Atomic Reconstructor recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Atomic Reconstructor recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/BallOfFur.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/BallOfFur.java index 35bb6d232..3d304cd15 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/BallOfFur.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/BallOfFur.java @@ -83,7 +83,9 @@ public RecipeBuilder weight(int weight) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Ball Of Fur recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Ball Of Fur recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java index 61dd4ed9d..4bd0cd2bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java @@ -111,7 +111,9 @@ public RecipeBuilder outputDisplay(IBlockState outputDisplay) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Compost recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Compost recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java index df2e556e5..248ed5e44 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java @@ -103,7 +103,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Crusher recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Crusher recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java index 6666f1d4f..019746cca 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java @@ -188,7 +188,9 @@ public RecipeBuilder blue(float blue) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Empowerer recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Empowerer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/NetherMiningLens.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/NetherMiningLens.java index 48bbafa7a..139ae21b6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/NetherMiningLens.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/NetherMiningLens.java @@ -102,7 +102,9 @@ public RecipeBuilder weight(int weight) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Nether Mining Lens recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Nether Mining Lens recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/OilGen.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/OilGen.java index a617ef531..e26790d18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/OilGen.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/OilGen.java @@ -115,7 +115,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Oil Gen recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Oil Gen recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/StoneMiningLens.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/StoneMiningLens.java index 961cdf5c9..6f3f53d8b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/StoneMiningLens.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/StoneMiningLens.java @@ -102,7 +102,9 @@ public RecipeBuilder weight(int weight) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Stone Mining Lens recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Stone Mining Lens recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/TreasureChest.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/TreasureChest.java index 8ac9f0c34..5dba58175 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/TreasureChest.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/TreasureChest.java @@ -100,7 +100,9 @@ public RecipeBuilder max(int max) { } @Override - public String getErrorMsg() { return "Error adding Actually Additions Treasure Chest Loot recipe"; } + public String getErrorMsg() { + return "Error adding Actually Additions Treasure Chest Loot recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/Mortar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/Mortar.java index 51cc452da..eaddfb880 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/Mortar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/Mortar.java @@ -180,7 +180,9 @@ public RecipeBuilder secondaryOutputChance(float chance) { } @Override - public String getErrorMsg() { return "Error adding Advanced Mortars recipe"; } + public String getErrorMsg() { + return "Error adding Advanced Mortars recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Accessory.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Accessory.java index 2deebfea7..094984877 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Accessory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Accessory.java @@ -69,7 +69,9 @@ public RecipeBuilder accessoryType(AccessoryType type) { } @Override - public String getErrorMsg() { return "Error adding Aether Accessory"; } + public String getErrorMsg() { + return "Error adding Aether Accessory"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java index d4ceb8229..a2a11331e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java @@ -53,7 +53,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Aether Enchanter Recipe"; } + public String getErrorMsg() { + return "Error adding Aether Enchanter Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java index b4b4fa0a7..a76fef7e0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java @@ -53,7 +53,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Aether Freezer Recipe"; } + public String getErrorMsg() { + return "Error adding Aether Freezer Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Alchemistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Alchemistry.java index c7fa1b4b1..9ab9f4255 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Alchemistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Alchemistry.java @@ -29,7 +29,9 @@ public void initialize(GroovyContainer container) { ChemicalCompound compound = CompoundRegistry.INSTANCE.get(parsedName); if (compound == null || compound.toItemStack(1).isEmpty()) { ChemicalElement element = ElementRegistry.INSTANCE.get(parsedName); - if (element == null || element.toItemStack(1).isEmpty()) { return Result.error(); } + if (element == null || element.toItemStack(1).isEmpty()) { + return Result.error(); + } return Result.some(element.toItemStack(1)); } return Result.some(compound.toItemStack(1)); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Atomizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Atomizer.java index d8d9806d4..f362dcc26 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Atomizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Atomizer.java @@ -105,7 +105,9 @@ public RecipeBuilder reversible() { } @Override - public String getErrorMsg() { return "Error adding Alchemistry Atomizer recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Atomizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Combiner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Combiner.java index 7ca0c1c9f..211dd3b7f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Combiner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Combiner.java @@ -104,7 +104,9 @@ public RecipeBuilder gamestage(String gamestage) { } @Override - public String getErrorMsg() { return "Error adding Alchemistry Combiner recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Combiner recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java index 68e278e4f..24fb6e59e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Dissolver.java @@ -155,7 +155,9 @@ public RecipeBuilder rolls(int rolls) { } @Override - public String getErrorMsg() { return "Error adding Alchemistry Dissolver recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Dissolver recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Electrolyzer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Electrolyzer.java index 7a4e8ae29..88a56508a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Electrolyzer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Electrolyzer.java @@ -144,7 +144,9 @@ public RecipeBuilder consumptionChance(int consumptionChance) { } @Override - public String getErrorMsg() { return "Error adding Alchemistry Electrolyzer recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Electrolyzer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Evaporator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Evaporator.java index 5b1e2a2d9..f5801ec97 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Evaporator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Evaporator.java @@ -89,7 +89,9 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Alchemistry Evaporator recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Evaporator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Liquifier.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Liquifier.java index eb819b71e..9ee6244ab 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Liquifier.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/Liquifier.java @@ -89,7 +89,9 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Alchemistry Liquifier recipe"; } + public String getErrorMsg() { + return "Error adding Alchemistry Liquifier recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Attunement.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Attunement.java index 770d0abba..4c603e597 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Attunement.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Attunement.java @@ -100,13 +100,15 @@ public void remove(Capability capability, TunnelType tunnel) { @MethodDescription public void removeByItem(ItemStack item) { - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getTunnels() - .entrySet() - .stream() - .filter(x -> x.getKey() - .isItemEqual(item)) - .collect(Collectors.toList())) { + for ( + Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getTunnels() + .entrySet() + .stream() + .filter(x -> x.getKey() + .isItemEqual(item)) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getTunnels().entrySet().removeIf(x -> x .getKey() @@ -116,13 +118,15 @@ public void removeByItem(ItemStack item) { @MethodDescription public void removeByMod(String modid) { - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getModIdTunnels() - .entrySet() - .stream() - .filter(x -> x.getKey() - .equals(modid)) - .collect(Collectors.toList())) { + for ( + Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getModIdTunnels() + .entrySet() + .stream() + .filter(x -> x.getKey() + .equals(modid)) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getModIdTunnels().entrySet().removeIf(x -> x .getKey() @@ -132,12 +136,14 @@ public void removeByMod(String modid) { @MethodDescription public void removeByCapability(Capability capability) { - for (Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getCapTunnels() - .entrySet() - .stream() - .filter(x -> x.getKey() == capability) - .collect(Collectors.toList())) { + for ( + Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getCapTunnels() + .entrySet() + .stream() + .filter(x -> x.getKey() == capability) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels().entrySet().removeIf(x -> x .getKey() == pair.getKey()); @@ -146,34 +152,40 @@ public void removeByCapability(Capability capability) { @MethodDescription(example = @Example("tunnel('item')")) public void removeByTunnel(TunnelType tunnel) { - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getTunnels() - .entrySet() - .stream() - .filter(x -> x.getValue() == tunnel) - .collect(Collectors.toList())) { + for ( + Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getTunnels() + .entrySet() + .stream() + .filter(x -> x.getValue() == tunnel) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getTunnels().entrySet().removeIf(x -> x .getKey() .isItemEqual(pair.getKey())); } - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getModIdTunnels() - .entrySet() - .stream() - .filter(x -> x.getValue() == tunnel) - .collect(Collectors.toList())) { + for ( + Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getModIdTunnels() + .entrySet() + .stream() + .filter(x -> x.getValue() == tunnel) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getModIdTunnels().entrySet().removeIf(x -> x .getKey() .equals(pair.getKey())); } - for (Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) - .getCapTunnels() - .entrySet() - .stream() - .filter(x -> x.getValue() == tunnel) - .collect(Collectors.toList())) { + for ( + Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()) + .getCapTunnels() + .entrySet() + .stream() + .filter(x -> x.getValue() == tunnel) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(pair.getKey(), pair.getValue())); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels().entrySet().removeIf(x -> x .getKey() == pair.getKey()); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Grinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Grinder.java index 82023ac95..a7be4669a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Grinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Grinder.java @@ -118,7 +118,9 @@ public RecipeBuilder chance2(float chance) { } @Override - public String getErrorMsg() { return "Error adding Applied Energistics 2 Grinder recipe"; } + public String getErrorMsg() { + return "Error adding Applied Energistics 2 Grinder recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java index fad0c3a71..482b62a46 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java @@ -116,7 +116,9 @@ public RecipeBuilder bottom(ItemStack bottom) { } @Override - public String getErrorMsg() { return "Error adding Applied Energistics 2 Inscriber recipe"; } + public String getErrorMsg() { + return "Error adding Applied Energistics 2 Inscriber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Spatial.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Spatial.java index ed98e0f91..8126dec93 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Spatial.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Spatial.java @@ -57,7 +57,9 @@ public void removeAll() { private static Class loadClass(String className) { try { return (Class) Class.forName(className); - } catch (Exception e) { + } catch ( + Exception e + ) { GroovyLog.get().error("Failed to load TileEntity class '{}'", className); } return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/GemCuttingTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/GemCuttingTable.java index 45242f4dc..9760d140d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/GemCuttingTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/GemCuttingTable.java @@ -96,10 +96,14 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getRecipeNamePrefix() { return "groovyscript_gem_cutting_table_"; } + public String getRecipeNamePrefix() { + return "groovyscript_gem_cutting_table_"; + } @Override - public String getErrorMsg() { return "Error adding Arcane Archives Gem Cutting Table recipe"; } + public String getErrorMsg() { + return "Error adding Arcane Archives Gem Cutting Table recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/AstralSorcery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/AstralSorcery.java index 47edf7a00..1c32fe35f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/AstralSorcery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/AstralSorcery.java @@ -40,7 +40,9 @@ public class AstralSorcery extends GroovyPropertyContainer { public void initialize(GroovyContainer container) { container.objectMapperBuilder("constellation", IConstellation.class).parser((s, args) -> { for (IConstellation constellation : ConstellationRegistryAccessor.getConstellationList()) { - if (constellation.getSimpleName().equalsIgnoreCase(s)) { return Result.some(constellation); } + if (constellation.getSimpleName().equalsIgnoreCase(s)) { + return Result.some(constellation); + } } return Result.error(); }).completerOfNamed(ConstellationRegistryAccessor::getConstellationList, IConstellation::getSimpleName).docOfType( diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java index 0913a87b0..f4e8756b9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/ChaliceInteraction.java @@ -63,12 +63,14 @@ private boolean remove(LiquidInteraction recipe) { @MethodDescription public void removeByInput(Fluid fluid1, Fluid fluid2) { getRegistry().removeIf(rec -> { - if ((rec.getComponent1().getFluid().equals(fluid1) && rec.getComponent2().getFluid().equals(fluid2)) || (rec + if ( + (rec.getComponent1().getFluid().equals(fluid1) && rec.getComponent2().getFluid().equals(fluid2)) || (rec .getComponent1() .getFluid() .equals(fluid2) && rec.getComponent2() .getFluid() - .equals(fluid1))) { + .equals(fluid1)) + ) { addBackup(rec); return true; } @@ -173,7 +175,9 @@ public RecipeBuilder fluidInput(FluidStack fluid) { } @Override - public String getErrorMsg() { return "Error adding Astral Sorcery Chalice Interaction"; } + public String getErrorMsg() { + return "Error adding Astral Sorcery Chalice Interaction"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java index eb998e4ce..581802a1c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java @@ -113,7 +113,9 @@ public RecipeBuilder secondaryChance(float chance) { } @Override - public String getErrorMsg() { return "Error adding Astral Sorcery Grindstone recipe"; } + public String getErrorMsg() { + return "Error adding Astral Sorcery Grindstone recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java index 0186593e5..6c0f28d13 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java @@ -145,7 +145,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Astral Infusion recipe"; } + public String getErrorMsg() { + return "Error adding Astral Infusion recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -158,8 +160,7 @@ public void validate(GroovyLog.Msg msg) { @Override @RecipeBuilderRegistrationMethod public @Nullable BasicInfusionRecipe register() { if (!validate()) return null; - BasicInfusionRecipe recipe = new BasicInfusionRecipe(output.get(0), AstralSorcery.toItemHandle(input.get(0))) - { + BasicInfusionRecipe recipe = new BasicInfusionRecipe(output.get(0), AstralSorcery.toItemHandle(input.get(0))) { @Override public int craftingTickTime() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/LightTransmutation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/LightTransmutation.java index 2a9569720..7509d683a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/LightTransmutation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/LightTransmutation.java @@ -181,7 +181,9 @@ public RecipeBuilder constellation(IWeakConstellation constellation) { } @Override - public String getErrorMsg() { return "Error adding Astral Sorcery Light Transmutation recipe"; } + public String getErrorMsg() { + return "Error adding Astral Sorcery Light Transmutation recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarRecipeBuilder.java index c00d0da57..3f05b06dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarRecipeBuilder.java @@ -65,11 +65,12 @@ private static List computeFluidConsumptionSlots(ItemHandle[] inputs) { private static DiscoveryRecipe discoveryAltar(String name, ItemStack output, ItemHandle[] inputs, int starlightRequired, int craftingTickTime, List fluidStacks) { - return new DiscoveryRecipe(registerNative(name, output, inputs)) - { + return new DiscoveryRecipe(registerNative(name, output, inputs)) { @Override - public int getPassiveStarlightRequired() { return starlightRequired; } + public int getPassiveStarlightRequired() { + return starlightRequired; + } @Override public int craftingTickTime() { @@ -85,11 +86,12 @@ public boolean mayDecrement(TileAltar ta, ShapedRecipeSlot slot) { private static AttunementRecipe attunementAltar(String name, ItemStack output, ItemHandle[] inputs, int starlightRequired, int craftingTickTime, List fluidStacks) { - AttunementRecipe recipe = new AttunementRecipe(registerNative(name, output, inputs)) - { + AttunementRecipe recipe = new AttunementRecipe(registerNative(name, output, inputs)) { @Override - public int getPassiveStarlightRequired() { return starlightRequired; } + public int getPassiveStarlightRequired() { + return starlightRequired; + } @Override public int craftingTickTime() { @@ -119,11 +121,12 @@ public boolean mayDecrement(TileAltar ta, AttunementAltarSlot slot) { private static ConstellationRecipe constellationAltar(String name, ItemStack output, ItemHandle[] inputs, int starlightRequired, int craftingTickTime, List fluidStacks) { - ConstellationRecipe recipe = new ConstellationRecipe(registerNative(name, output, inputs)) - { + ConstellationRecipe recipe = new ConstellationRecipe(registerNative(name, output, inputs)) { @Override - public int getPassiveStarlightRequired() { return starlightRequired; } + public int getPassiveStarlightRequired() { + return starlightRequired; + } @Override public int craftingTickTime() { @@ -163,11 +166,12 @@ public boolean mayDecrement(TileAltar ta, ConstellationAtlarSlot slot) { private static TraitRecipe traitAltar(String name, ItemStack output, ItemHandle[] inputs, int starlightRequired, int craftingTickTime, List fluidStacks, IConstellation requiredConstellation, ItemHandle[] outerInputs) { - TraitRecipe recipe = new TraitRecipe(registerNative(name, output, inputs)) - { + TraitRecipe recipe = new TraitRecipe(registerNative(name, output, inputs)) { @Override - public int getPassiveStarlightRequired() { return starlightRequired; } + public int getPassiveStarlightRequired() { + return starlightRequired; + } @Override public int craftingTickTime() { @@ -303,7 +307,9 @@ public Shaped outerInput(Collection ings) { private boolean flattenMatrix() { ItemHandle[] in = AltarInputOrder.initInputList(this.altarLevel); int[][] map = AltarInputOrder.getMap(this.altarLevel); - if (map == null || in == null) { return false; } + if (map == null || in == null) { + return false; + } for (int i = 0; i < this.keyBasedMatrix.length; i++) { String row = this.keyBasedMatrix[i]; @@ -326,7 +332,9 @@ private boolean flattenMatrix() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_starlight_altar_recipe_"; } + public String getRecipeNamePrefix() { + return "groovyscript_starlight_altar_recipe_"; + } @Override @GroovyBlacklist public void validateName() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Compressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Compressor.java index c015a919e..fcfba8233 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Compressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Compressor.java @@ -100,10 +100,14 @@ public RecipeBuilder inputCount(int inputCount) { } @Override - public String getRecipeNamePrefix() { return "avaritia_compressor_"; } + public String getRecipeNamePrefix() { + return "avaritia_compressor_"; + } @Override - public String getErrorMsg() { return "Error adding Avaritia compressor recipe"; } + public String getErrorMsg() { + return "Error adding Avaritia compressor recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/ExtremeRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/ExtremeRecipeBuilder.java index deae024c8..2ea5e5520 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/ExtremeRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/ExtremeRecipeBuilder.java @@ -21,7 +21,9 @@ public Shaped() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_extreme_shaped_"; } + public String getRecipeNamePrefix() { + return "groovyscript_extreme_shaped_"; + } @Override @RecipeBuilderRegistrationMethod(hierarchy = 5) public IExtremeRecipe register() { @@ -71,7 +73,9 @@ public Shapeless() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_extreme_shapeless_"; } + public String getRecipeNamePrefix() { + return "groovyscript_extreme_shapeless_"; + } public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg("Error adding shapeless Extended Crafting Table recipe").error(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Cauldron.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Cauldron.java index 201aa6511..c9fac88c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Cauldron.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Cauldron.java @@ -125,7 +125,9 @@ public RecipeBuilder priority(int priority) { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Cauldron recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Cauldron recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Crucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Crucible.java index 235e6fb8d..f26af807f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Crucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Crucible.java @@ -130,7 +130,9 @@ public RecipeBuilder priority(int priority) { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Cauldron recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Cauldron recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Hopper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Hopper.java index b10d3304f..6e64f241e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Hopper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Hopper.java @@ -118,7 +118,9 @@ public RecipeBuilder inWorldItemOutput(Collection inWorldItemOutputs) } @Override - public String getErrorMsg() { return "Error adding Better With Mods Filtered Hopper recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Filtered Hopper recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java index 1cd3444a3..35a5c13b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java @@ -116,10 +116,14 @@ public RecipeBuilder filter(IIngredient filter) { } @Override - public String getRecipeNamePrefix() { return "groovyscript_hopper_filter_"; } + public String getRecipeNamePrefix() { + return "groovyscript_hopper_filter_"; + } @Override - public String getErrorMsg() { return "Error adding Better With Mods Hopper Filter recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Hopper Filter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java index 187b7e1c3..b8522541b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java @@ -145,7 +145,9 @@ public RecipeBuilder ignoreHeat() { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Kiln recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Kiln recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java index 7a1484c6f..3e472b432 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java @@ -130,7 +130,9 @@ public RecipeBuilder priority(int priority) { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Mill recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Mill recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java index 3d79e642a..210e18c07 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java @@ -123,7 +123,9 @@ public RecipeBuilder input(IIngredient input) { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Saw recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Saw recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java index dcbe4422e..58d184c7b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java @@ -142,7 +142,9 @@ public RecipeBuilder rotations(int rotations) { } @Override - public String getErrorMsg() { return "Error adding Better With Mods Turntable recipe"; } + public String getErrorMsg() { + return "Error adding Better With Mods Turntable recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java index 24fc6ac09..e75f88d2a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java @@ -69,15 +69,21 @@ public boolean remove(RecipeAlchemyArray recipe) { @MethodDescription(example = @Example("item('bloodmagic:component:13')")) public boolean removeByInput(IIngredient input) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( recipe -> { boolean found = recipe.getInput() .test(IngredientHelper.toItemStack(input)); - if (found) { + if ( + found + ) { addBackup(recipe); } return found; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Array recipe").add("could not find recipe with input {}", input).error() .post(); @@ -86,15 +92,21 @@ public boolean removeByInput(IIngredient input) { @MethodDescription(example = @Example("item('bloodmagic:slate:2')")) public boolean removeByCatalyst(IIngredient catalyst) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( recipe -> { boolean found = recipe.getCatalyst() .test(IngredientHelper.toItemStack(catalyst)); - if (found) { + if ( + found + ) { addBackup(recipe); } return found; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Array recipe").add("could not find recipe with catalyst {}", catalyst) .error().post(); @@ -103,16 +115,22 @@ public boolean removeByCatalyst(IIngredient catalyst) { @MethodDescription(example = @Example("item('bloodmagic:component:7'), item('bloodmagic:slate:1')")) public boolean removeByInputAndCatalyst(IIngredient input, IIngredient catalyst) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( recipe -> { boolean removeRecipe = recipe.getInput() .test(IngredientHelper.toItemStack(input)) && recipe.getCatalyst() .test(IngredientHelper.toItemStack(catalyst)); - if (removeRecipe) { + if ( + removeRecipe + ) { addBackup(recipe); } return removeRecipe; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Array recipe").add( "could not find recipe with input {} and catalyst {}", @@ -122,15 +140,21 @@ public boolean removeByInputAndCatalyst(IIngredient input, IIngredient catalyst) @MethodDescription(example = @Example("item('bloodmagic:sigil_void')")) public boolean removeByOutput(ItemStack output) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyArrayRecipes().removeIf( recipe -> { boolean matches = recipe.getOutput() .isItemEqual(output); - if (matches) { + if ( + matches + ) { addBackup(recipe); } return matches; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Array recipe").add("could not find recipe with output {}", output) .error().post(); @@ -177,7 +201,9 @@ public RecipeBuilder texture(String texture) { } @Override - public String getErrorMsg() { return "Error adding Blood Magic Alchemy Array recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Alchemy Array recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java index c214f70d1..89a12ffae 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java @@ -70,22 +70,33 @@ public boolean removeByInput(IIngredient... input) { @MethodDescription(example = @Example("item('minecraft:nether_wart'), item('minecraft:gunpowder')")) public boolean removeByInput(NonNullList input) { // Filters down to only recipes which have inputs that match all the input IIngredients (NOTE: a recipe with ABCD would match an input of AB) - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyRecipes().removeIf( recipe -> { boolean removeRecipe = false; - for (IIngredient match : input) { + for ( + IIngredient match : input + ) { boolean foundInputMatch = false; - for (Ingredient target : recipe.getInput()) { - if (target.test(IngredientHelper.toItemStack(match))) - foundInputMatch = true; + for ( + Ingredient target : recipe.getInput() + ) { + if ( + target.test(IngredientHelper.toItemStack(match)) + ) foundInputMatch = true; } removeRecipe = foundInputMatch; } - if (removeRecipe) { + if ( + removeRecipe + ) { addBackup(recipe); } return removeRecipe; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Table recipe").add( "could not find recipe with inputs including all of {}", @@ -95,15 +106,21 @@ public boolean removeByInput(NonNullList input) { @MethodDescription(example = @Example("item('minecraft:sand')")) public boolean removeByOutput(ItemStack output) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAlchemyRecipes().removeIf( recipe -> { boolean matches = ItemStack.areItemStacksEqual(recipe.getOutput(), output); - if (matches) { + if ( + matches + ) { addBackup(recipe); } return matches; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Alchemy Table recipe").add("could not find recipe with output {}", output) .error().post(); return false; @@ -167,7 +184,9 @@ public RecipeBuilder tier(int tier) { } @Override - public String getErrorMsg() { return "Error adding Blood Magic Alchemy Table recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Alchemy Table recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java index 82d4e4b0c..189576552 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java @@ -61,15 +61,21 @@ public boolean remove(RecipeBloodAltar recipe) { @MethodDescription(example = @Example("item('minecraft:ender_pearl')")) public boolean removeByInput(IIngredient input) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAltarRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAltarRecipes().removeIf( recipe -> { boolean removeRecipe = recipe.getInput() .test(IngredientHelper.toItemStack(input)); - if (removeRecipe) { + if ( + removeRecipe + ) { addBackup(recipe); } return removeRecipe; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Blood Altar recipe").add("could not find recipe with input {}", input).error() .post(); @@ -78,15 +84,21 @@ public boolean removeByInput(IIngredient input) { @MethodDescription(example = @Example("item('bloodmagic:slate:4')")) public boolean removeByOutput(ItemStack output) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAltarRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getAltarRecipes().removeIf( recipe -> { boolean matches = ItemStack.areItemStacksEqual(recipe.getOutput(), output); - if (matches) { + if ( + matches + ) { addBackup(recipe); } return matches; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Blood Altar recipe").add("could not find recipe with output {}", output).error() .post(); @@ -147,7 +159,9 @@ public RecipeBuilder drainRate(int drainRate) { } @Override - public String getErrorMsg() { return "Error adding Blood Magic Blood Altar recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Blood Altar recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Meteor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Meteor.java index 8c835cfd6..8077d9887 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Meteor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Meteor.java @@ -150,7 +150,9 @@ public RecipeBuilder cost(int cost) { } @Override - public String getErrorMsg() { return "Error adding Blood Magic Alchemy Array recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Alchemy Array recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Sacrificial.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Sacrificial.java index 650b18e10..4c2ea450d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Sacrificial.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Sacrificial.java @@ -135,7 +135,9 @@ public RecipeBuilder value(int value) { return this; } - public String getErrorMsg() { return "Error adding Blood Magic Tranquility key recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Tranquility key recipe"; + } public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg(getErrorMsg()).error(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java index 24d9b3184..9669456f3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java @@ -80,22 +80,33 @@ public boolean removeByInput(IIngredient... input) { @MethodDescription public boolean removeByInput(NonNullList input) { // Filters down to only recipes which have inputs that match all the input IIngredients (NOTE: a recipe with ABCD would match an input of AB) - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getTartaricForgeRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getTartaricForgeRecipes().removeIf( recipe -> { boolean removeRecipe = false; - for (IIngredient match : input) { + for ( + IIngredient match : input + ) { boolean foundInputMatch = false; - for (Ingredient target : recipe.getInput()) { - if (target.test(IngredientHelper.toItemStack(match))) - foundInputMatch = true; + for ( + Ingredient target : recipe.getInput() + ) { + if ( + target.test(IngredientHelper.toItemStack(match)) + ) foundInputMatch = true; } removeRecipe = foundInputMatch; } - if (removeRecipe) { + if ( + removeRecipe + ) { addBackup(recipe); } return removeRecipe; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Tartaric Forge recipe").add( "could not find recipe with inputs including all of {}", @@ -105,15 +116,21 @@ public boolean removeByInput(NonNullList input) { @MethodDescription(example = @Example("item('bloodmagic:demon_crystal')")) public boolean removeByOutput(ItemStack output) { - if (((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getTartaricForgeRecipes().removeIf( + if ( + ((BloodMagicRecipeRegistrarAccessor) BloodMagicAPI.INSTANCE.getRecipeRegistrar()).getTartaricForgeRecipes().removeIf( recipe -> { boolean matches = ItemStack.areItemStacksEqual(recipe.getOutput(), output); - if (matches) { + if ( + matches + ) { addBackup(recipe); } return matches; - })) { return true; } + }) + ) { + return true; + } GroovyLog.msg("Error removing Blood Magic Tartaric Forge recipe").add("could not find recipe with output {}", output) .error().post(); return false; @@ -159,7 +176,9 @@ public RecipeBuilder drain(int drain) { } @Override - public String getErrorMsg() { return "Error adding Blood Magic Tartaric Forge recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Tartaric Forge recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Tranquility.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Tranquility.java index e56aa7999..b79ad4ba4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Tranquility.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/Tranquility.java @@ -105,8 +105,9 @@ public void remove(IBlockState blockstate, String tranquility) { @MethodDescription(description = "groovyscript.wiki.bloodmagic.tranquility.remove3") public boolean remove(IBlockState blockstate, EnumTranquilityType tranquility) { - for (Map.Entry entry : BloodMagicAPI.INSTANCE.getValueManager().getTranquility() - .entrySet()) { + for ( + Map.Entry entry : BloodMagicAPI.INSTANCE.getValueManager().getTranquility().entrySet() + ) { if (entry.getKey() == blockstate && entry.getValue().type == tranquility) { TranquilityStack stack = entry.getValue(); addBackup(Pair.of(entry.getKey(), entry.getValue())); @@ -197,7 +198,9 @@ public RecipeBuilder value(double value) { return this; } - public String getErrorMsg() { return "Error adding Blood Magic Tranquility key recipe"; } + public String getErrorMsg() { + return "Error adding Blood Magic Tranquility key recipe"; + } public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg(getErrorMsg()).error(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java index 6bd1dc0bc..7f506ae1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java @@ -114,7 +114,9 @@ public SimpleObjectStream streamRecipes() { public class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Botania Apothecary recipe"; } + public String getErrorMsg() { + return "Error adding Botania Apothecary recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Brew.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Brew.java index 2de01c5a2..a501fa54f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Brew.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Brew.java @@ -156,7 +156,9 @@ public BrewBuilder effect(Collection effects) { } @Override - public String getErrorMsg() { return "Error adding Botania Brew"; } + public String getErrorMsg() { + return "Error adding Botania Brew"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/BrewRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/BrewRecipe.java index c80ec3014..31565a498 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/BrewRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/BrewRecipe.java @@ -116,7 +116,9 @@ public RecipeBuilder brew(vazkii.botania.api.brew.Brew brew) { } @Override - public String getErrorMsg() { return "Error adding Botania Brew recipe"; } + public String getErrorMsg() { + return "Error adding Botania Brew recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ElvenTrade.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ElvenTrade.java index 037f82338..b06a3a2f4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ElvenTrade.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ElvenTrade.java @@ -110,7 +110,9 @@ public SimpleObjectStream streamRecipes() { public class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Botania Elven Trade recipe"; } + public String getErrorMsg() { + return "Error adding Botania Elven Trade recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Lexicon.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Lexicon.java index 9522f9598..8d0881394 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Lexicon.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Lexicon.java @@ -417,7 +417,9 @@ public EntryBuilder extraRecipe(IIngredient stack) { } @Override - public String getErrorMsg() { return "Error adding Botania Lexicon Entry"; } + public String getErrorMsg() { + return "Error adding Botania Lexicon Entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java index 77c8daea4..17d7ae7c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java @@ -135,7 +135,9 @@ public RecipeBuilder useConjuration() { } @Override - public String getErrorMsg() { return "Error adding Botania Mana Infusion recipe"; } + public String getErrorMsg() { + return "Error adding Botania Mana Infusion recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/PureDaisy.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/PureDaisy.java index bb766b70f..f82c8f376 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/PureDaisy.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/PureDaisy.java @@ -161,7 +161,9 @@ public RecipeBuilder input(OreDictIngredient input) { } @Override - public String getErrorMsg() { return "Error adding Botania Pure Daisy recipe"; } + public String getErrorMsg() { + return "Error adding Botania Pure Daisy recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java index 3db12561d..deb94672c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java @@ -119,7 +119,9 @@ public RecipeBuilder mana(int amount) { } @Override - public String getErrorMsg() { return "Error adding Botania Rune Altar recipe"; } + public String getErrorMsg() { + return "Error adding Botania Rune Altar recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/recipe/MagnetSubject.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/recipe/MagnetSubject.java index 06007865f..18bc9c7bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/recipe/MagnetSubject.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/recipe/MagnetSubject.java @@ -23,7 +23,9 @@ public MagnetSubject(Block block, int meta) { this.item = null; } - public boolean isBlock() { return block != null; } + public boolean isBlock() { + return block != null; + } public String getMagnetKey() { return isBlock() ? BotaniaAPIAccessor.invokeGetMagnetKey(block, meta) : BotaniaAPIAccessor.invokeGetMagnetKey(item diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java index c41447ab5..5c0695c2a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Algorithm Separator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Algorithm Separator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AnalysingChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AnalysingChamber.java index 35eb9e2e9..176fb4401 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AnalysingChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AnalysingChamber.java @@ -123,7 +123,9 @@ public RecipeBuilder location(int location) { } @Override - public String getErrorMsg() { return "Error adding Calculator Analysing Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Analysing Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java index 516fe5011..e7fe0ff3d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Atomic Calculator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Atomic Calculator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java index 52b4060d1..fe5fdca71 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java @@ -95,7 +95,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Basic Calculator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Basic Calculator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java index 8f7dfd6df..322bac2af 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java @@ -99,7 +99,9 @@ public RecipeBuilder value(int value) { } @Override - public String getErrorMsg() { return "Error adding Calculator Conductor Mast Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Conductor Mast Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java index 22df33fb2..3d2bcfd79 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java @@ -107,7 +107,9 @@ public RecipeBuilder isDamaged(boolean isDamaged) { } @Override - public String getErrorMsg() { return "Error adding Calculator Extraction Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Extraction Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FabricationChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FabricationChamber.java index 0897cc5a2..144fd1ffe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FabricationChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FabricationChamber.java @@ -99,7 +99,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Fabrication Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Fabrication Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java index 268d84c86..887b1866e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Flawless Calculator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Flawless Calculator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java index 3be78d4c2..e050cb96a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java @@ -84,7 +84,9 @@ public RecipeBuilder value(int value) { } @Override - public String getErrorMsg() { return "Error adding Calculator Glowstone Extractor Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Glowstone Extractor Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java index dc7daf807..db5fc231b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java @@ -84,7 +84,9 @@ public RecipeBuilder value(int value) { } @Override - public String getErrorMsg() { return "Error adding Calculator Health Processor Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Health Processor Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java index ad6cfd476..6ae9aa003 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java @@ -91,7 +91,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Precision Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Precision Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java index 4155075e9..9b531a9fd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Processing Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Processing Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java index 597df884a..d5cbb95ef 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Reassembly Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Reassembly Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java index 0b4835b2a..a08f4d4a6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java @@ -84,7 +84,9 @@ public RecipeBuilder value(int value) { } @Override - public String getErrorMsg() { return "Error adding Calculator Redstone Extractor Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Redstone Extractor Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java index fb54f5d3a..2386017b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Restoration Chamber Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Restoration Chamber Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java index 386613ffc..621343432 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Scientific Calculator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Scientific Calculator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java index e84e4d57b..dbbd665b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java @@ -84,7 +84,9 @@ public RecipeBuilder value(int value) { } @Override - public String getErrorMsg() { return "Error adding Calculator Starch Extractor Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Starch Extractor Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java index 512761a81..343945636 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java @@ -90,7 +90,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Calculator Stone Separator Recipe"; } + public String getErrorMsg() { + return "Error adding Calculator Stone Separator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java index f72d46eea..78a1b3481 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java @@ -62,7 +62,9 @@ public void addVariation(String groupName, ItemStack item) { try { getRegistry().addVariation(groupName, CarvingUtils.variationFor(item, 0)); addScripted(Pair.of(groupName, item)); - } catch (UnsupportedOperationException e) { + } catch ( + UnsupportedOperationException e + ) { GroovyLog.msg("Error adding a Chisel Carving variation").add("you cannot add variations to Oredict chisel groups {}", groupName).add( "instead, edit the oredict via `oredict.add('{}', {})`", @@ -79,7 +81,9 @@ public void removeVariation(String groupName, ItemStack item) { try { getRegistry().removeVariation(item, groupName); addBackup(Pair.of(groupName, item)); - } catch (UnsupportedOperationException e) { + } catch ( + UnsupportedOperationException e + ) { GroovyLog.msg("Error removing a Chisel Carving variation").add( "you cannot remove variations to Oredict chisel groups {}", groupName).add( diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java index 698e7cbf2..9a1d39ae8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java @@ -48,10 +48,12 @@ public boolean remove(org.dave.compactmachines3.miniaturization.MultiblockRecipe @MethodDescription(example = @Example("item('minecraft:ender_pearl')")) public void removeByInput(ItemStack input) { - for (org.dave.compactmachines3.miniaturization.MultiblockRecipe recipe : MultiblockRecipes.getRecipes().stream().filter( - r -> r.getCatalystStack() - .isItemEqual(input)) - .collect(Collectors.toList())) { + for ( + org.dave.compactmachines3.miniaturization.MultiblockRecipe recipe : MultiblockRecipes.getRecipes().stream().filter( + r -> r.getCatalystStack() + .isItemEqual(input)) + .collect(Collectors.toList()) + ) { addBackup(recipe); MultiblockRecipes.getRecipes().removeIf(r -> r == recipe); } @@ -64,10 +66,12 @@ public void removeByCatalyst(ItemStack catalyst) { @MethodDescription(example = @Example("item('compactmachines3:machine:3')")) public void removeByOutput(ItemStack output) { - for (org.dave.compactmachines3.miniaturization.MultiblockRecipe recipe : MultiblockRecipes.getRecipes().stream().filter( - r -> r.getTargetStack() - .isItemEqual(output)) - .collect(Collectors.toList())) { + for ( + org.dave.compactmachines3.miniaturization.MultiblockRecipe recipe : MultiblockRecipes.getRecipes().stream().filter( + r -> r.getTargetStack() + .isItemEqual(output)) + .collect(Collectors.toList()) + ) { addBackup(recipe); MultiblockRecipes.getRecipes().removeIf(r -> r == recipe); } @@ -173,7 +177,9 @@ public RecipeBuilder duration(int duration) { } @Override - public String getErrorMsg() { return "Error adding Compact Machines Multiblock recipe"; } + public String getErrorMsg() { + return "Error adding Compact Machines Multiblock recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -240,13 +246,21 @@ public ReferenceValues(IBlockState state, NBTTagCompound nbt, boolean ignoreMeta this.reference = reference; } - public IBlockState getState() { return state; } + public IBlockState getState() { + return state; + } - public NBTTagCompound getNbt() { return nbt; } + public NBTTagCompound getNbt() { + return nbt; + } - public boolean isIgnoreMeta() { return ignoreMeta; } + public boolean isIgnoreMeta() { + return ignoreMeta; + } - public ItemStack getReference() { return reference; } + public ItemStack getReference() { + return reference; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/EnergyCore.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/EnergyCore.java index c74ea99ba..0352493cc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/EnergyCore.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/EnergyCore.java @@ -44,10 +44,14 @@ private void init() { } @Override - public boolean isEnabled() { return GroovyScriptConfig.compat.draconicEvolutionEnergyCore; } + public boolean isEnabled() { + return GroovyScriptConfig.compat.draconicEvolutionEnergyCore; + } @Override - public Collection getAliases() { return Alias.generateOfClass(EnergyCore.class); } + public Collection getAliases() { + return Alias.generateOfClass(EnergyCore.class); + } @Override public void onReload() { @@ -64,7 +68,9 @@ public void onReload() { public void afterScriptLoad() {} @GroovyBlacklist - public int getVersion() { return version; } + public int getVersion() { + return version; + } @GroovyBlacklist @ApiStatus.Internal public void applyEdit(BlockStateMultiblockStorage[] mbs) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/Fusion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/Fusion.java index 6f907c9d7..34a8f6be8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/Fusion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/Fusion.java @@ -48,9 +48,11 @@ public boolean remove(IFusionRecipe recipe) { @MethodDescription(example = @Example("item('draconicevolution:chaos_shard')")) public void removeByCatalyst(ItemStack item) { - for (IFusionRecipe recipe : RecipeManager.FUSION_REGISTRY.getRecipes().stream().filter(x -> x.getRecipeCatalyst() - .isItemEqual(item)).collect( - Collectors.toList())) { + for ( + IFusionRecipe recipe : RecipeManager.FUSION_REGISTRY.getRecipes().stream().filter(x -> x.getRecipeCatalyst() + .isItemEqual(item)).collect( + Collectors.toList()) + ) { remove(recipe); } } @@ -121,7 +123,9 @@ public RecipeBuilder tierChaotic() { } @Override - public String getErrorMsg() { return "Error adding Draconic Evolution Fusion recipe"; } + public String getErrorMsg() { + return "Error adding Draconic Evolution Fusion recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/GroovyFusionRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/GroovyFusionRecipe.java index cb28e27a4..ca3d01c34 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/GroovyFusionRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/GroovyFusionRecipe.java @@ -51,21 +51,31 @@ public boolean isRecipeCatalyst(ItemStack itemStack) { } @Override - public List getRecipeIngredients() { return this.displayItems; } + public List getRecipeIngredients() { + return this.displayItems; + } @Override - public int getRecipeTier() { return craftingTier; } + public int getRecipeTier() { + return craftingTier; + } @Override - public ItemStack getRecipeCatalyst() { return catalyst; } + public ItemStack getRecipeCatalyst() { + return catalyst; + } @Override - public long getIngredientEnergyCost() { return energyCost; } + public long getIngredientEnergyCost() { + return energyCost; + } @Override public boolean matches(IFusionCraftingInventory inventory, World world, BlockPos blockPos) { ItemStack coreStack = inventory.getStackInCore(0); - if (coreStack.isEmpty() || !isRecipeCatalyst(coreStack) || coreStack.getCount() < catalyst.getCount()) { return false; } + if (coreStack.isEmpty() || !isRecipeCatalyst(coreStack) || coreStack.getCount() < catalyst.getCount()) { + return false; + } List injectors = new ArrayList<>(inventory.getInjectors()); int found = 0; @@ -74,8 +84,10 @@ public boolean matches(IFusionCraftingInventory inventory, World world, BlockPos Iterator it = injectors.iterator(); while (it.hasNext()) { ICraftingInjector craftingInjector = it.next(); - if (ingredient.test(craftingInjector.getStackInPedestal()) && ingredient.getAmount() <= craftingInjector.getStackInPedestal() - .getCount()) { + if ( + ingredient.test(craftingInjector.getStackInPedestal()) && ingredient.getAmount() <= craftingInjector.getStackInPedestal() + .getCount() + ) { found++; it.remove(); break; @@ -127,13 +139,17 @@ public void onCraftingTick(IFusionCraftingInventory iFusionCraftingInventory, Wo @Override public String canCraft(IFusionCraftingInventory inventory, World world, BlockPos blockPos) { - if (!inventory.getStackInCore(1).isEmpty()) { return "outputObstructed"; } + if (!inventory.getStackInCore(1).isEmpty()) { + return "outputObstructed"; + } Iterator it = inventory.getInjectors().iterator(); ICraftingInjector pedestal; do { - if (!it.hasNext()) { return "true"; } + if (!it.hasNext()) { + return "true"; + } pedestal = it.next(); } while (pedestal.getStackInPedestal().isEmpty() || pedestal.getPedestalTier() >= this.craftingTier); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateEnergyCoreStructure.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateEnergyCoreStructure.java index 05d0cc2e9..ff1e7ca56 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateEnergyCoreStructure.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateEnergyCoreStructure.java @@ -64,7 +64,9 @@ public BlockStateEnergyCoreStructure(TileEnergyStorageCore core) { structureTiers[7] = buildTierOMG(); } - public BlockStateMultiblockHelper getHelper() { return helper; } + public BlockStateMultiblockHelper getHelper() { + return helper; + } public boolean checkVersion() { if (version != ModSupport.DRACONIC_EVOLUTION.get().energyCore.getVersion()) { @@ -198,7 +200,9 @@ private void renderBuildGuide(BlockStates states, World world, BlockPos pos, Blo IBlockState atState = world.getBlockState(pos); boolean invalid = !world.isAirBlock(pos) && !states.matches(atState, false); - if (dist + 2 > pDist && !invalid) { return; } + if (dist + 2 > pDist && !invalid) { + return; + } BlockPos translation = new BlockPos(pos.getX() - startPos.getX(), pos.getY() - startPos.getY(), pos.getZ() - startPos .getZ()); @@ -278,7 +282,9 @@ public void setBlock(BlockStates states, World world, BlockPos pos) { } } - public BlockStateMultiblockStorage[] getStructureTiers() { return structureTiers; } + public BlockStateMultiblockStorage[] getStructureTiers() { + return structureTiers; + } private BlockStateMultiblockStorage buildTier1() { BlockStateMultiblockStorage storage = new BlockStateMultiblockStorage(1, helper, this); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockStorage.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockStorage.java index c0e4351de..12cf52772 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockStorage.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockStorage.java @@ -69,7 +69,9 @@ public void mirrorHalf() { public void newLayer() { xPos = 0; yPos++; - if (this.yPos >= size) { throw new RuntimeException("[MultiBlockStorage] Attempt to add too many layers to structure"); } + if (this.yPos >= size) { + throw new RuntimeException("[MultiBlockStorage] Attempt to add too many layers to structure"); + } } @Override @@ -116,9 +118,15 @@ public void forEachBlockStates(BlockPos startPos, BiConsumer find(ItemStack output) { private void removeInternal(Collection recipes) { AlloyRecipeManagerAccessor accessor = (AlloyRecipeManagerAccessor) AlloyRecipeManager.getInstance(); @SuppressWarnings("unchecked") Int2ObjectOpenHashMap, ItemRecipeNode>>> map = ((ItemRecipeNodeAccessor>>) ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); - for (NNPair, ItemRecipeNode>> pair : map.values()) { + for ( + NNPair, ItemRecipeNode>> pair : map.values() + ) { Iterator listIter = pair.left.iterator(); while (listIter.hasNext()) { if (recipes.contains(listIter.next())) { @@ -150,7 +152,9 @@ public SimpleObjectStream streamRecipes() { public void removeAll() { AlloyRecipeManagerAccessor accessor = (AlloyRecipeManagerAccessor) AlloyRecipeManager.getInstance(); @SuppressWarnings("unchecked") Int2ObjectOpenHashMap, ItemRecipeNode>>> map = ((ItemRecipeNodeAccessor>>) ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); - for (NNPair, ItemRecipeNode>> pair : map.values()) { + for ( + NNPair, ItemRecipeNode>> pair : map.values() + ) { Iterator listIter = pair.left.iterator(); while (listIter.hasNext()) { addBackup(listIter.next()); @@ -176,7 +180,9 @@ public RecipeBuilder xp(float xp) { } @Override - public String getErrorMsg() { return "Error adding EnderIO Alloy Smelter recipe"; } + public String getErrorMsg() { + return "Error adding EnderIO Alloy Smelter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java index b24e7cecb..d8ecde3b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java @@ -66,8 +66,9 @@ public void remove(Enchantment enchantment) { return; } List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.ENCHANTER) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.ENCHANTER).values() + ) { if (recipe instanceof EnchanterRecipe && enchantment == ((EnchanterRecipe) recipe).getEnchantment()) { recipes.add((EnchanterRecipe) recipe); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java index 7da4a0a05..65a12f555 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java @@ -121,7 +121,9 @@ public RecipeBuilder bonusTypeChance() { } @Override - public String getErrorMsg() { return "Error adding EnderIO Sag Mill recipe"; } + public String getErrorMsg() { + return "Error adding EnderIO Sag Mill recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java index 20bd2a861..ee428e30e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java @@ -106,7 +106,9 @@ public RecipeBuilder duration(int duration) { } @Override - public String getErrorMsg() { return "Error adding EnderIO Sag Mill Grinding Ball entry"; } + public String getErrorMsg() { + return "Error adding EnderIO Sag Mill Grinding Ball entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java index e657d9681..607be643b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java @@ -130,7 +130,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding EnderIO Slice'n'Splice recipe"; } + public String getErrorMsg() { + return "Error adding EnderIO Slice'n'Splice recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java index 42890ce5b..42b4b05aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java @@ -52,8 +52,9 @@ public boolean remove(ISoulBinderRecipe recipe) { @MethodDescription(description = "groovyscript.wiki.removeByOutput", example = @Example("item('enderio:item_material:17')")) public void remove(ItemStack output) { List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.SOULBINDER) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.SOULBINDER).values() + ) { if (OreDictionary.itemMatches(output, ((ISoulBinderRecipe) recipe).getOutputStack(), false)) { recipes.add((ISoulBinderRecipe) recipe); } @@ -169,7 +170,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding EnderIO Soul Binder recipe"; } + public String getErrorMsg() { + return "Error adding EnderIO Soul Binder recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -190,8 +193,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; BasicSoulBinderRecipe recipe = new BasicSoulBinderRecipe(input.get(0).getMatchingStacks()[0], output.get(0), energy, xp, name, RecipeLevel.IGNORE, entities, - new BasicSoulBinderRecipe.OutputFilter() - {}); + new BasicSoulBinderRecipe.OutputFilter() {}); ModSupport.ENDER_IO.get().soulBinder.add(recipe); return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java index 608538251..1831bb327 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java @@ -103,8 +103,10 @@ public void removeFill(ItemStack input, FluidStack fluid) { if (msg.postIfNotEmpty()) return; List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_FILLING) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_FILLING) + .values() + ) { TankMachineRecipe tankMachineRecipe = (TankMachineRecipe) recipe; if (tankMachineRecipe.getFluid().isFluidEqual(fluid) && tankMachineRecipe.getInput().contains(input)) { recipes.add(tankMachineRecipe); @@ -128,8 +130,10 @@ public void removeFill(FluidStack fluid, ItemStack output) { if (msg.postIfNotEmpty()) return; List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_FILLING) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_FILLING) + .values() + ) { TankMachineRecipe tankMachineRecipe = (TankMachineRecipe) recipe; if (tankMachineRecipe.getFluid().isFluidEqual(fluid) && tankMachineRecipe.getOutput().contains(output)) { recipes.add(tankMachineRecipe); @@ -154,8 +158,10 @@ public void removeDrain(ItemStack input, FluidStack fluid) { if (msg.postIfNotEmpty()) return; List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_EMPTYING) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_EMPTYING) + .values() + ) { TankMachineRecipe tankMachineRecipe = (TankMachineRecipe) recipe; if (tankMachineRecipe.getFluid().isFluidEqual(fluid) && tankMachineRecipe.getInput().contains(input)) { recipes.add(tankMachineRecipe); @@ -179,8 +185,10 @@ public void removeDrain(FluidStack fluid, ItemStack output) { if (msg.postIfNotEmpty()) return; List recipes = new ArrayList<>(); - for (IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_EMPTYING) - .values()) { + for ( + IMachineRecipe recipe : MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.TANK_EMPTYING) + .values() + ) { TankMachineRecipe tankMachineRecipe = (TankMachineRecipe) recipe; if (tankMachineRecipe.getFluid().isFluidEqual(fluid) && tankMachineRecipe.getOutput().contains(output)) { recipes.add(tankMachineRecipe); @@ -248,10 +256,14 @@ public RecipeBuilder drain() { } @Override - public String getErrorMsg() { return "Error adding EnderIO Tank recipe"; } + public String getErrorMsg() { + return "Error adding EnderIO Tank recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_enderio_tank_"; } + public String getRecipeNamePrefix() { + return "groovyscript_enderio_tank_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java index b3f092af3..ae7a7116e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java @@ -210,6 +210,8 @@ public VatRecipeInput(IIngredient ing, int slot, float multiplier) { } @Override - public float getMulitplier() { return multiplier; } + public float getMulitplier() { + return multiplier; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/CustomEnchanterRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/CustomEnchanterRecipe.java index cb5f76871..f6c739c5f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/CustomEnchanterRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/CustomEnchanterRecipe.java @@ -29,10 +29,14 @@ public CustomEnchanterRecipe(@NotNull IIngredient input, int stackSizePerLevel, } @NotNull @Override - public Things getLapis() { return lapis; } + public Things getLapis() { + return lapis; + } @NotNull @Override - public Things getBook() { return book; } + public Things getBook() { + return book; + } @Override public boolean isRecipe(@Nonnull RecipeLevel machineLevel, @Nonnull NNList inputs) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/ManyToOneRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/ManyToOneRecipe.java index 13b77996e..a664ea435 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/ManyToOneRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/ManyToOneRecipe.java @@ -20,7 +20,9 @@ public ManyToOneRecipe(RecipeOutput output, int energyRequired, RecipeBonusType super(output, energyRequired, bonusType, level, input); } - public RecipeOutput getOutput() { return getOutputs()[0]; } + public RecipeOutput getOutput() { + return getOutputs()[0]; + } @Override public boolean isInputForRecipe(NNList machineInputs) { @@ -43,9 +45,13 @@ public boolean isValidInput(@NotNull FluidStack fluid) { @Override public boolean isValidInput(int slot, @NotNull ItemStack item) { IRecipeInput input = getInputs()[slot]; - if ((input.getSlotNumber() < 0 || input.getSlotNumber() == slot) && input.isInput(item)) { return true; } + if ((input.getSlotNumber() < 0 || input.getSlotNumber() == slot) && input.isInput(item)) { + return true; + } for (IRecipeInput input1 : getInputs()) { - if ((input1.getSlotNumber() < 0 || input1.getSlotNumber() == slot) && input1.isInput(item)) { return true; } + if ((input1.getSlotNumber() < 0 || input1.getSlotNumber() == slot) && input1.isInput(item)) { + return true; + } } return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/RecipeInput.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/RecipeInput.java index ad5738737..8d80c6658 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/RecipeInput.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/recipe/RecipeInput.java @@ -34,7 +34,9 @@ public IRecipeInput copy() { } @Override - public boolean isFluid() { return ing instanceof FluidStack; } + public boolean isFluid() { + return ing instanceof FluidStack; + } @Nonnull @Override public ItemStack getInput() { @@ -42,13 +44,19 @@ public ItemStack getInput() { } @Override - public FluidStack getFluidInput() { return ing instanceof FluidStack ? ((FluidStack) ing).copy() : null; } + public FluidStack getFluidInput() { + return ing instanceof FluidStack ? ((FluidStack) ing).copy() : null; + } @Override - public float getMulitplier() { return 1; } + public float getMulitplier() { + return 1; + } @Override - public int getSlotNumber() { return slot; } + public int getSlotNumber() { + return slot; + } @Override public boolean isInput(@Nonnull ItemStack test) { @@ -69,7 +77,9 @@ public ItemStack[] getEquivelentInputs() { } @Override - public boolean isValid() { return true; } + public boolean isValid() { + return true; + } @Override public void shrinkStack(int count) { @@ -77,6 +87,8 @@ public void shrinkStack(int count) { } @Override - public int getStackSize() { return ing.getAmount(); } + public int getStackSize() { + return ing.getAmount(); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java index 59882678c..e2e2cdf3f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java @@ -69,7 +69,9 @@ public RecipeBuilder mru(int cost) { } @Override - public String getErrorMsg() { return "Error adding Magician Table Recipe"; } + public String getErrorMsg() { + return "Error adding Magician Table Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagmaticSmeltery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagmaticSmeltery.java index e3753eb8a..516ed944d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagmaticSmeltery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagmaticSmeltery.java @@ -106,7 +106,9 @@ public MagmaticSmeltery.RecipeBuilder factor(int factor) { return this; } - public String getErrorMsg() { return "Error adding Magmatic Smeltery Recipe"; } + public String getErrorMsg() { + return "Error adding Magmatic Smeltery Recipe"; + } public void validate(GroovyLog.Msg msg) { msg.add(OreSmeltingRecipe.RECIPE_MAP.containsKey(input), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MithrilineFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MithrilineFurnace.java index 681dbd062..661595177 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MithrilineFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MithrilineFurnace.java @@ -80,7 +80,9 @@ public RecipeBuilder espe(int cost) { } @Override - public String getErrorMsg() { return "Error adding Mithriline Furnace Recipe"; } + public String getErrorMsg() { + return "Error adding Mithriline Furnace Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java index a440e13c6..3d6076256 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java @@ -96,7 +96,9 @@ public RadiatingChamber.RecipeBuilder upperBalance(float upperBalance) { } @Override - public String getErrorMsg() { return "Error adding Magician Table Recipe"; } + public String getErrorMsg() { + return "Error adding Magician Table Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java index 4cb1b522e..9da7485c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java @@ -80,7 +80,9 @@ public RecipeBuilder espe(int cost) { } @Override - public String getErrorMsg() { return "Error adding Wind Rune Recipe"; } + public String getErrorMsg() { + return "Error adding Wind Rune Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java index 195392770..e1fdd5086 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java @@ -25,7 +25,9 @@ public class BloodInfuser extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(BloodInfuserConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(BloodInfuserConfig.class); + } @RecipeBuilderDescription(example = {@Example(".input(item('minecraft:clay')).output(item('minecraft:clay')).fluidInput(fluid('evilcraftblood') * 1000).tier(3).duration(100).xp(10000)"), @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:clay')).fluidInput(100000)"), @@ -138,7 +140,9 @@ public RecipeBuilder fluidInput(int amount) { } @Override - public String getErrorMsg() { return "Error adding EvilCraft Blood Infuser Recipe"; } + public String getErrorMsg() { + return "Error adding EvilCraft Blood Infuser Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java index 8400232be..ef0fa6e45 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java @@ -24,7 +24,9 @@ public class EnvironmentalAccumulator extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(EnvironmentalAccumulatorConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(EnvironmentalAccumulatorConfig.class); + } @RecipeBuilderDescription(example = {@Example(".input(item('minecraft:clay')).output(item('minecraft:clay') * 2).inputWeather(weather('clear')).outputWeather(weather('rain')).processingspeed(1).cooldowntime(1000).duration(10)"), @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).inputWeather(weather('rain')).outputWeather(weather('lightning')).speed(10).cooldown(1)"), @@ -167,7 +169,9 @@ public RecipeBuilder outputWeather(WeatherType outputWeather) { } @Override - public String getErrorMsg() { return "Error adding EvilCraft Environmental Accumulator Recipe"; } + public String getErrorMsg() { + return "Error adding EvilCraft Environmental Accumulator Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CombinationCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CombinationCrafting.java index 65e1d3cc3..600da0e2e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CombinationCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CombinationCrafting.java @@ -173,7 +173,9 @@ public RecipeBuilder pedestals(IIngredient... pedestals) { } @Override - public String getErrorMsg() { return "Error adding Extended Crafting Combination Crafting recipe"; } + public String getErrorMsg() { + return "Error adding Extended Crafting Combination Crafting recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CompressionCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CompressionCrafting.java index 9b0eb4635..361374c55 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CompressionCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/CompressionCrafting.java @@ -169,7 +169,9 @@ public RecipeBuilder powerRate(int powerRate) { } @Override - public String getErrorMsg() { return "Error adding Extended Crafting Compression Crafting recipe"; } + public String getErrorMsg() { + return "Error adding Extended Crafting Compression Crafting recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java index 87eb490ab..6be775c04 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderRecipeBuilder.java @@ -38,7 +38,9 @@ public Shaped() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_ender_shaped_"; } + public String getRecipeNamePrefix() { + return "groovyscript_ender_shaped_"; + } @Override @RecipeBuilderMethodDescription public Shaped time(int time) { @@ -105,7 +107,9 @@ public Shapeless() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_ender_shapeless_"; } + public String getRecipeNamePrefix() { + return "groovyscript_ender_shapeless_"; + } @Override @RecipeBuilderMethodDescription public Shapeless time(int time) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableRecipeBuilder.java index 242d011bc..c90f86883 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableRecipeBuilder.java @@ -54,7 +54,9 @@ public Shaped() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_table_shaped_"; } + public String getRecipeNamePrefix() { + return "groovyscript_table_shaped_"; + } @Override @RecipeBuilderMethodDescription public TableRecipeBuilder.Shaped tier(int tier) { @@ -116,7 +118,9 @@ public Shapeless() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_table_shapeless_"; } + public String getRecipeNamePrefix() { + return "groovyscript_table_shapeless_"; + } @Override @RecipeBuilderMethodDescription public TableRecipeBuilder.Shapeless tier(int tier) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Crusher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Crusher.java index ddcebfc78..29803347a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Crusher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Crusher.java @@ -44,8 +44,10 @@ public boolean remove(IMachineRecipe recipe) { public boolean removeByInput(IIngredient input) { List agony = new ArrayList<>(); for (IMachineRecipe recipe : XUMachineCrusher.INSTANCE.recipes_registry) { - if (recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineCrusher.INPUT).stream()).anyMatch( - input)) { + if ( + recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineCrusher.INPUT).stream()).anyMatch( + input) + ) { agony.add(recipe); } } @@ -114,7 +116,9 @@ public RecipeBuilder chance(float chance) { } @Override - public String getErrorMsg() { return "Error adding Extra Utilities 2 Crusher recipe"; } + public String getErrorMsg() { + return "Error adding Extra Utilities 2 Crusher recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Enchanter.java index bb2a83480..e1c311332 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Enchanter.java @@ -43,8 +43,10 @@ public boolean remove(IMachineRecipe recipe) { public boolean removeByInput(IIngredient input) { List agony = new ArrayList<>(); for (IMachineRecipe recipe : XUMachineEnchanter.INSTANCE.recipes_registry) { - if (recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineEnchanter.INPUT).stream()) - .anyMatch(input)) { + if ( + recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineEnchanter.INPUT).stream()) + .anyMatch(input) + ) { agony.add(recipe); } } @@ -104,7 +106,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Extra Utilities 2 Enchanter recipe"; } + public String getErrorMsg() { + return "Error adding Extra Utilities 2 Enchanter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Furnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Furnace.java index 74a6a65f7..a3395688e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Furnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Furnace.java @@ -46,8 +46,10 @@ public boolean remove(IMachineRecipe recipe) { public boolean removeByInput(IIngredient input) { List agony = new ArrayList<>(); for (IMachineRecipe recipe : XUMachineFurnace.INSTANCE.recipes_registry) { - if (recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineFurnace.INPUT).stream()).anyMatch( - input)) { + if ( + recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineFurnace.INPUT).stream()).anyMatch( + input) + ) { agony.add(recipe); } } @@ -105,7 +107,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Extra Utilities 2 Furnace recipe"; } + public String getErrorMsg() { + return "Error adding Extra Utilities 2 Furnace recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Generator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Generator.java index 95fbb28c5..8713c374b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Generator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Generator.java @@ -86,8 +86,10 @@ public boolean remove(ResourceLocation name, IMachineRecipe recipe) { public boolean remove(Machine machine, ItemStack input) { List agony = new ArrayList<>(); for (IMachineRecipe recipe : machine.recipes_registry) { - if (recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineGenerators.INPUT_ITEM).stream()) - .anyMatch(input::isItemEqual)) { + if ( + recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getKey().get(XUMachineGenerators.INPUT_ITEM).stream()) + .anyMatch(input::isItemEqual) + ) { agony.add(recipe); } } @@ -118,8 +120,10 @@ public boolean remove(ResourceLocation name, ItemStack input) { public boolean remove(Machine machine, FluidStack input) { List agony = new ArrayList<>(); for (IMachineRecipe recipe : machine.recipes_registry) { - if (recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getValue().get(XUMachineGenerators.INPUT_FLUID).stream()) - .anyMatch(input::isFluidEqual)) { + if ( + recipe.getJEIInputItemExamples().stream().flatMap(x -> x.getValue().get(XUMachineGenerators.INPUT_FLUID).stream()) + .anyMatch(input::isFluidEqual) + ) { agony.add(recipe); } } @@ -284,7 +288,9 @@ public RecipeBuilder energyPerTick(int energyPerTick) { } @Override - public String getErrorMsg() { return "Error adding Extra Utilities 2 Generator recipe"; } + public String getErrorMsg() { + return "Error adding Extra Utilities 2 Generator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Resonator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Resonator.java index e728ffc75..0efad5a38 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Resonator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/Resonator.java @@ -164,7 +164,9 @@ public RecipeBuilder rainbow() { Collection s = freq.getSubTypes(TileRainbowGenerator.rainbowGenerators); if (s != null) { for (TileRainbowGenerator power : s) { - if (power.providing) { return true; } + if (power.providing) { + return true; + } } } } @@ -176,7 +178,9 @@ public RecipeBuilder rainbow() { @Override - public String getErrorMsg() { return "Error adding Extra Utilities 2 Resonator recipe"; } + public String getErrorMsg() { + return "Error adding Extra Utilities 2 Resonator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -188,11 +192,12 @@ public void validate(GroovyLog.Msg msg) { @Nullable @Override @RecipeBuilderRegistrationMethod public IResonatorRecipe register() { if (!validate()) return null; - IResonatorRecipe recipe = new ResonatorRecipe(input.get(0).getMatchingStacks()[0], output.get(0), energy, ownerTag) - { + IResonatorRecipe recipe = new ResonatorRecipe(input.get(0).getMatchingStacks()[0], output.get(0), energy, ownerTag) { @Override - public String getRequirementText() { return requirementText == null ? "" : requirementText; } + public String getRequirementText() { + return requirementText == null ? "" : requirementText; + } @Override public boolean shouldProgress(TileEntity resonator, int frequency, ItemStack input) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeMutations.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeMutations.java index fb3b627bc..bb0bd1fe1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeMutations.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeMutations.java @@ -35,7 +35,9 @@ public void onReload() { } @Override @GroovyBlacklist - public boolean isEnabled() { return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.APICULTURE); } + public boolean isEnabled() { + return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.APICULTURE); + } public IBeeMutation add(AlleleBeeSpecies output, AlleleBeeSpecies a, AlleleBeeSpecies b, double chance, @Nullable Function requirement) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeProduce.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeProduce.java index e2bd883ea..1d8422afc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeProduce.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/BeeProduce.java @@ -43,7 +43,9 @@ public boolean removeFromBee(BeeProduct product) { } @Override @GroovyBlacklist - public boolean isEnabled() { return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.APICULTURE); } + public boolean isEnabled() { + return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.APICULTURE); + } public BeeProduct add(AlleleBeeSpecies species, ItemStack output, float chance, boolean specialty) { BeeProduct product = new BeeProduct(species, output, chance, specialty); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java index 7d3abbdd7..af2181c08 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java @@ -182,7 +182,9 @@ public RecipeBuilder shape(String... pattern) { } @Override - public String getErrorMsg() { return "Error adding Forestry Carpenter recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Carpenter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java index cbf2a64da..344026a62 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java @@ -104,7 +104,9 @@ public RecipeBuilder output(ItemStack output) { } @Override - public String getErrorMsg() { return "Error adding Forestry Centrifuge recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Centrifuge recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/CharcoalPile.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/CharcoalPile.java index 04bac6d9e..f82741cbe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/CharcoalPile.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/CharcoalPile.java @@ -23,7 +23,9 @@ public void onReload() { } @Override @GroovyBlacklist - public boolean isEnabled() { return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.CHARCOAL); } + public boolean isEnabled() { + return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.CHARCOAL); + } public ICharcoalPileWall add(IBlockState state, int amount) { if (!isEnabled() || state == null) return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Fermenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Fermenter.java index bfb0055de..4918ce5f3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Fermenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Fermenter.java @@ -112,7 +112,9 @@ public RecipeBuilder modifier(float modifier) { } @Override - public String getErrorMsg() { return "Error adding Forestry Fermenter recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Fermenter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ForestryRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ForestryRegistry.java index 8f317a436..21f7bd899 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ForestryRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ForestryRegistry.java @@ -20,5 +20,7 @@ public ForestryRegistry(@Nullable Collection aliases) { } @Override @GroovyBlacklist @ApiStatus.Internal - public boolean isEnabled() { return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.FACTORY); } + public boolean isEnabled() { + return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.FACTORY); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java index 5fbd159c5..65a118cc5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java @@ -88,7 +88,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Forestry Moistener recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Moistener recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Squeezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Squeezer.java index 38e6f810c..c38f7ab1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Squeezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Squeezer.java @@ -108,7 +108,9 @@ public RecipeBuilder chance(float chance) { } @Override - public String getErrorMsg() { return "Error adding Forestry Squeezer recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Squeezer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Still.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Still.java index 7a21ac05f..0282826f5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Still.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Still.java @@ -85,7 +85,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Forestry Still recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Still recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java index 5bb007151..ba2abd988 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java @@ -146,7 +146,9 @@ public RecipeBuilder shape(String... pattern) { } @Override - public String getErrorMsg() { return "Error adding Forestry Thermionic Fabricator recipe"; } + public String getErrorMsg() { + return "Error adding Forestry Thermionic Fabricator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/Centrifuge.java index 5e578048b..502457f7a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/Centrifuge.java @@ -56,8 +56,10 @@ public void removeByOutput(ItemStack... outputs) { GroovyLog.msg("Error removing Industrialcraft 2 Centrifuge recipe").add("outputs must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.centrifuge.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.centrifuge.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> recipe = iterator.next(); if (recipe.getOutput().size() == outputs.length) { @@ -81,8 +83,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Centrifuge recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.centrifuge.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.centrifuge.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -92,8 +96,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.centrifuge.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.centrifuge.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -105,8 +111,10 @@ public SimpleObjectStream>> st } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.centrifuge.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.centrifuge.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/IC2.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/IC2.java index edf80ba04..5e5e380c1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/IC2.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/IC2.java @@ -71,7 +71,9 @@ public IC2() { public static boolean isExp() { for (ModContainer container : Loader.instance().getActiveModList()) { - if ("ic2".equals(container.getModId())) { return container.getMetadata().version.contains("ex"); } + if ("ic2".equals(container.getModId())) { + return container.getMetadata().version.contains("ex"); + } } return false; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/MetalFormer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/MetalFormer.java index 3e9709f96..20664e646 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/MetalFormer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/MetalFormer.java @@ -61,15 +61,19 @@ public boolean remove(MachineRecipe> recipe) } public void removeByOutput(int type, ItemStack output) { - if (GroovyLog.msg("Error removing Industrialcraft 2 Metal Former recipe").add(type < 0 || type > 2, + if ( + GroovyLog.msg("Error removing Industrialcraft 2 Metal Former recipe").add(type < 0 || type > 2, () -> "type must be between 0-2").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } - for (Iterator>> iterator = getManager(type).getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = getManager(type).getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (ItemStack.areItemStacksEqual((ItemStack) rec.getOutput().toArray()[0], output)) { iterator.remove(); @@ -79,15 +83,19 @@ public void removeByOutput(int type, ItemStack output) { } public void removeByInput(int type, ItemStack input) { - if (GroovyLog.msg("Error removing Industrialcraft 2 Metal Former recipe").add(type < 0 || type > 2, + if ( + GroovyLog.msg("Error removing Industrialcraft 2 Metal Former recipe").add(type < 0 || type > 2, () -> "type must be between 0-2").add( IngredientHelper.isEmpty(input), () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } - for (Iterator>> iterator = getManager(type).getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = getManager(type).getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -101,8 +109,10 @@ public void removeAll(int type) { GroovyLog.msg("Error removing Industrialcraft 2 Metal Former recipe").add("type must be between 0-2").error().post(); return; } - for (Iterator>> iterator = getManager(type).getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = getManager(type).getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(new MetalFormerRecipe(type, rec)); @@ -110,8 +120,10 @@ public void removeAll(int type) { } private boolean remove(int type, MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = getManager(type).getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = getManager(type).getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/OreWasher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/OreWasher.java index eeb63f610..b7b0c0494 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/OreWasher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/OreWasher.java @@ -60,8 +60,10 @@ public void removeByOutput(ItemStack... outputs) { GroovyLog.msg("Error removing Industrialcraft 2 Ore Washer recipe").add("outputs must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.oreWashing.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.oreWashing.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> recipe = iterator.next(); if (recipe.getOutput().size() == outputs.length) { @@ -85,8 +87,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Ore Washer recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.oreWashing.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.oreWashing.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -96,8 +100,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.oreWashing.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.oreWashing.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -105,8 +111,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.oreWashing.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.oreWashing.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/RecipeInput.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/RecipeInput.java index 7b6ef86cb..dc3759154 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/RecipeInput.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/RecipeInput.java @@ -23,8 +23,12 @@ public boolean matches(ItemStack itemStack) { } @Override - public int getAmount() { return this.ingredient.getAmount(); } + public int getAmount() { + return this.ingredient.getAmount(); + } @Override - public List getInputs() { return Arrays.asList(this.ingredient.getMatchingStacks()); } + public List getInputs() { + return Arrays.asList(this.ingredient.getMatchingStacks()); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Canner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Canner.java index 8905ebff4..809896887 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Canner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Canner.java @@ -33,11 +33,13 @@ public void onReload() { } public CanningRecipe addCanning(ItemStack output, IIngredient input, ItemStack container) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Canner Canning recipe").add(IngredientHelper.isEmpty(output), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Canner Canning recipe").add(IngredientHelper.isEmpty(output), () -> "output must not be empty").add( IngredientHelper.isEmpty(input), () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } CanningRecipe recipe = new CanningRecipe(RecipeType.CANNING_RECIPE).setOutput(output).setInput(input).setContainer( @@ -48,8 +50,10 @@ public CanningRecipe addCanning(ItemStack output, IIngredient input, ItemStack c } public CanningRecipe registerItemEffect(int id, IIngredient input) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Canner Item Effect recipe").add(id < 0, () -> "id must not be negative") - .add(IngredientHelper.isEmpty(input), () -> "input must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Canner Item Effect recipe").add(id < 0, () -> "id must not be negative") + .add(IngredientHelper.isEmpty(input), () -> "input must not be empty").error().postIfNotEmpty() + ) { return null; } CanningRecipe recipe = new CanningRecipe(RecipeType.ITEM_EFFECT).setInt(id).setInput(input); @@ -59,11 +63,13 @@ public CanningRecipe registerItemEffect(int id, IIngredient input) { } public CanningRecipe registerFuelValue(IIngredient ingredient, int value) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Canner Fuel Value").add(IngredientHelper.isEmpty(ingredient), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Canner Fuel Value").add(IngredientHelper.isEmpty(ingredient), () -> "ingredient must not be empty").add( value <= 0, () -> "value must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } CanningRecipe recipe = new CanningRecipe(RecipeType.FUEL_VALUE).setInt(value).setInput(ingredient); @@ -73,11 +79,13 @@ public CanningRecipe registerFuelValue(IIngredient ingredient, int value) { } public CanningRecipe registerFuelValue(IIngredient ingredient, int value, float value1) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Canner Fuel Value").add(IngredientHelper.isEmpty(ingredient), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Canner Fuel Value").add(IngredientHelper.isEmpty(ingredient), () -> "ingredient must not be empty").add( value <= 0, () -> "value must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } CanningRecipe recipe = new CanningRecipe(RecipeType.FUEL_VALUE).setInt(value).setInput(ingredient).setFloat(value1); @@ -169,8 +177,10 @@ public void removeAllItemEffect() { } public boolean removeAllRepair() { - for (Map.Entry>>> entry : ClassicRecipes.canningMachine.getRepairMap() - .entrySet()) { + for ( + Map.Entry>>> entry : ClassicRecipes.canningMachine.getRepairMap() + .entrySet() + ) { for (Tuple> tuple : entry.getValue()) { CanningRecipe recipe = new CanningRecipe(RecipeType.REPAIR).setDamageItem(entry.getKey()).setMeta(tuple .getFirst()) @@ -191,8 +201,10 @@ public boolean removeCanning(ItemStack container) { .post(); return false; } - for (Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() - .entrySet()) { + for ( + Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() + .entrySet() + ) { if (ItemStack.areItemStacksEqual(entry.getKey(), container)) { for (Tuple tuple : entry.getValue()) { CanningRecipe recipe = new CanningRecipe(RecipeType.CANNING_RECIPE).setContainer(container).setInput( @@ -211,15 +223,19 @@ public boolean removeCanning(ItemStack container) { } public void removeCanningByInputs(ItemStack input, ItemStack container) { - if (GroovyLog.msg("Error removing Industrialcraft 2 Canning Machine recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing Industrialcraft 2 Canning Machine recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(container), () -> "container must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } - for (Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() - .entrySet()) { + for ( + Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() + .entrySet() + ) { if (ItemStack.areItemStacksEqual(entry.getKey(), container)) { for (Tuple tuple : entry.getValue()) { if (tuple.getFirst().matches(input)) { @@ -241,8 +257,10 @@ public void removeCanningByOutput(ItemStack output) { .post(); return; } - for (Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() - .entrySet()) { + for ( + Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() + .entrySet() + ) { for (Tuple tuple : entry.getValue()) { if (ItemStack.areItemStacksEqual(tuple.getSecond(), output)) { CanningRecipe recipe = new CanningRecipe(RecipeType.CANNING_RECIPE).setContainer(entry.getKey()).setInput( @@ -257,8 +275,10 @@ public void removeCanningByOutput(ItemStack output) { } public void removeAllCanning() { - for (Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() - .entrySet()) { + for ( + Map.Entry>> entry : ClassicRecipes.canningMachine.getCanningMap() + .entrySet() + ) { for (Tuple tuple : entry.getValue()) { CanningRecipe recipe = new CanningRecipe(RecipeType.CANNING_RECIPE).setContainer(entry.getKey().copy()).setInput( new ItemsIngredient(new ArrayList<>(tuple.getFirst() diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicCompressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicCompressor.java index a24618f4f..8bbad8d6c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicCompressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicCompressor.java @@ -32,11 +32,13 @@ public void onReload() { @Override public MachineRecipe> add(IIngredient input, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -51,11 +53,13 @@ public MachineRecipe> add(IIngredient input, } public MachineRecipe> add(IIngredient input, ItemStack output, float xp) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } if (xp < 0) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicElectrolyzer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicElectrolyzer.java index 3ff08e8f3..ab046b136 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicElectrolyzer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicElectrolyzer.java @@ -25,11 +25,13 @@ public void onReload() { } public ElectrolyzerRecipe addBoth(ItemStack output, IIngredient input, int energy) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty()) { + .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty() + ) { return null; } ElectrolyzerRecipe recipe = new ElectrolyzerRecipe(RecipeType.BOTH, input, output, energy); @@ -39,11 +41,13 @@ public ElectrolyzerRecipe addBoth(ItemStack output, IIngredient input, int energ } public ElectrolyzerRecipe addCharge(ItemStack output, IIngredient input, int energy) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty()) { + .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty() + ) { return null; } ElectrolyzerRecipe recipe = new ElectrolyzerRecipe(RecipeType.CHARGE, input, output, energy); @@ -53,11 +57,13 @@ public ElectrolyzerRecipe addCharge(ItemStack output, IIngredient input, int ene } public ElectrolyzerRecipe addDischarge(ItemStack output, IIngredient input, int energy) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty()) { + .add(energy <= 0, () -> "energy must be higher than zero").error().postIfNotEmpty() + ) { return null; } ElectrolyzerRecipe recipe = new ElectrolyzerRecipe(RecipeType.DISCHARGE, input, output, energy); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicExtractor.java index fdcb349e9..247534da2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicExtractor.java @@ -38,11 +38,13 @@ public void add(MachineRecipe> recipe) { @Override public MachineRecipe> add(IIngredient input, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -52,11 +54,13 @@ public MachineRecipe> add(IIngredient input, } public MachineRecipe> add(IIngredient input, ItemStack output, float xp) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } if (xp < 0) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicMacerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicMacerator.java index 0760a7984..ed589fd7c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicMacerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicMacerator.java @@ -31,11 +31,13 @@ public void onReload() { @Override public MachineRecipe> add(ItemStack output, IIngredient input) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -45,11 +47,13 @@ public MachineRecipe> add(ItemStack output, } public MachineRecipe> add(ItemStack output, IIngredient input, float xp) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } if (xp < 0) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicScrapbox.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicScrapbox.java index df44598aa..ed62faf8e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicScrapbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/ClassicScrapbox.java @@ -26,10 +26,12 @@ public void add(IClassicScrapBoxManager.IDrop drop) { @Override public void add(ItemStack stack, float chance) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Scrapbox recipe").add(IngredientHelper.isEmpty(stack), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Scrapbox recipe").add(IngredientHelper.isEmpty(stack), () -> "stack must not be emtpy").add(chance <= 0, () -> "chance must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } ClassicRecipes.scrapboxDrops.addDrop(stack, chance); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/LiquidFuelGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/LiquidFuelGenerator.java index 0e766d566..da45ac3c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/LiquidFuelGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/LiquidFuelGenerator.java @@ -32,10 +32,12 @@ public void add(LFGRecipe recipe) { } public LFGRecipe add(FluidStack fluid, int burnTicks, float euPerTick) { - if (GroovyLog.msg("Error adding Fluid Generator recipe").add(IngredientHelper.isEmpty(fluid), + if ( + GroovyLog.msg("Error adding Fluid Generator recipe").add(IngredientHelper.isEmpty(fluid), () -> "fluid must not be empty").add(burnTicks <= 0, () -> "burnTicks must be higher than zero") - .add(euPerTick <= 0, () -> "euPerTick must be higher than zero").error().postIfNotEmpty()) { + .add(euPerTick <= 0, () -> "euPerTick must be higher than zero").error().postIfNotEmpty() + ) { return null; } LFGRecipe recipe = new LFGRecipe(fluid, burnTicks, euPerTick); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/RareEarthExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/RareEarthExtractor.java index 47f60d00e..8477d817b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/RareEarthExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/RareEarthExtractor.java @@ -26,11 +26,13 @@ public void add(IRareEarthExtractorRecipeList.EarthEntry entry) { } public void add(IIngredient input, float value) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Rare Earth Extractor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Rare Earth Extractor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( value <= 0, () -> "value must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } for (ItemStack stack : input.getMatchingStacks()) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Sawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Sawmill.java index 44ceeb5d6..f01aadd0f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Sawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/classic/Sawmill.java @@ -24,11 +24,13 @@ public void onReload() { } public IMachineRecipeList.RecipeEntry add(ItemStack output, IIngredient input) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Sawmill recipe").add(IngredientHelper.isEmpty(output), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Sawmill recipe").add(IngredientHelper.isEmpty(output), () -> "output must not be empty").add( IngredientHelper.isEmpty(input), () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } IMachineRecipeList.RecipeEntry entry = new IMachineRecipeList.RecipeEntry(new RecipeInput(input), new MachineOutput(null, @@ -40,11 +42,13 @@ public IMachineRecipeList.RecipeEntry add(ItemStack output, IIngredient input) { } public IMachineRecipeList.RecipeEntry add(ItemStack output, IIngredient input, float xp) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Sawmill recipe").add(IngredientHelper.isEmpty(output), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Sawmill recipe").add(IngredientHelper.isEmpty(output), () -> "output must not be empty").add( IngredientHelper.isEmpty(input), () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } if (xp < 0) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlastFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlastFurnace.java index 5d6981adf..1aeca401c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlastFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlastFurnace.java @@ -33,11 +33,13 @@ public void add(MachineRecipe> recipe) { } public MachineRecipe> add(IIngredient input, List output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Blast Furnace recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Blast Furnace recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add(IC2 .isNull(output), () -> "output must not be null") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), output); @@ -46,11 +48,13 @@ public MachineRecipe> add(IIngredient input, } public MachineRecipe> add(IIngredient input, List output, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Blast Furnace recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Blast Furnace recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add(IC2 .isNull(output), () -> "output must not be null") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), output, tag); @@ -72,8 +76,10 @@ public void removeByOutput(ItemStack... outputs) { .post(); return; } - for (Iterator>> iterator = Recipes.blastfurnace.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blastfurnace.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> recipe = iterator.next(); if (recipe.getOutput().size() == outputs.length) { @@ -97,8 +103,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Blast Furnace recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.blastfurnace.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blastfurnace.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -108,8 +116,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.blastfurnace.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blastfurnace.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -117,8 +127,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.blastfurnace.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blastfurnace.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlockCutter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlockCutter.java index dad3b392f..099819430 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlockCutter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlockCutter.java @@ -33,11 +33,13 @@ public void add(MachineRecipe> recipe) { } public MachineRecipe> add(IIngredient input, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Block Cutter recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Block Cutter recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -59,8 +61,10 @@ public void removeByOutput(ItemStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Block Cutter recipe").add("output must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.blockcutter.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blockcutter.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (ItemStack.areItemStacksEqual((ItemStack) rec.getOutput().toArray()[0], output)) { iterator.remove(); @@ -74,8 +78,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Block Cutter recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.blockcutter.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blockcutter.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -85,8 +91,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.blockcutter.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blockcutter.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -94,8 +102,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.blockcutter.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.blockcutter.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Compressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Compressor.java index 12ecea878..11cca1a18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Compressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Compressor.java @@ -29,11 +29,13 @@ public void add(MachineRecipe> recipe) { } public MachineRecipe> add(IIngredient input, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -43,11 +45,13 @@ public MachineRecipe> add(IIngredient input, } public MachineRecipe> add(IIngredient input, ItemStack output, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Compressor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -70,8 +74,10 @@ public void removeByOutput(ItemStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Compressor recipe").add("output must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.compressor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.compressor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (ItemStack.areItemStacksEqual((ItemStack) rec.getOutput().toArray()[0], output)) { iterator.remove(); @@ -82,8 +88,10 @@ public void removeByOutput(ItemStack output) { public void removeByInput(ItemStack input) { if (!IngredientHelper.isEmpty(input)) { - for (Iterator>> iterator = Recipes.compressor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.compressor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -96,8 +104,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.compressor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.compressor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -105,8 +115,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.compressor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.compressor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Electrolyzer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Electrolyzer.java index d3b624802..a6dcf53b7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Electrolyzer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Electrolyzer.java @@ -50,14 +50,16 @@ public boolean remove(String name, IElectrolyzerRecipeManager.ElectrolyzerRecipe public Pair add(FluidStack input, int euATick, int ticksNeeded, FluidStack... outputs) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Electrolyzer recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( euATick <= 0, () -> "energy per tick must be higher than zero") .add(ticksNeeded <= 0, () -> "recipe time must be higher than zero").add( outputs == null || outputs.length <= 0, () -> "outputs must not be null") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } List list = new ArrayList<>(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Extractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Extractor.java index 6fe3eed7c..094b7022b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Extractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Extractor.java @@ -29,11 +29,13 @@ public void add(MachineRecipe> recipe) { } public MachineRecipe> add(IIngredient input, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -43,11 +45,13 @@ public MachineRecipe> add(IIngredient input, } public MachineRecipe> add(IIngredient input, ItemStack output, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Extractor recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -70,8 +74,10 @@ public void removeByOutput(ItemStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Extractor recipe").add("output must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.extractor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.extractor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (ItemStack.areItemStacksEqual((ItemStack) rec.getOutput().toArray()[0], output)) { iterator.remove(); @@ -85,8 +91,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Extractor recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.extractor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.extractor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(input)) { iterator.remove(); @@ -96,8 +104,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.extractor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.extractor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -105,8 +115,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.extractor.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.extractor.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Fermenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Fermenter.java index ed89e3791..bc47693c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Fermenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Fermenter.java @@ -26,10 +26,12 @@ public void onReload() { } public Pair add(FluidStack input, int heat, FluidStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Fermenter recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Fermenter recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add(heat <= 0, () -> "heat must be higher than zero") - .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty() + ) { return null; } Pair pair = Pair.of(input.getFluid().getName(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidCanner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidCanner.java index cd574e592..3eeb08179 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidCanner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidCanner.java @@ -33,11 +33,13 @@ public void add(MachineRecipe reci public MachineRecipe add(FluidStack input, IIngredient input1, FluidStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Fluid Canner recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Fluid Canner recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be empty").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty() + ) { return null; } MachineRecipe recipe = create(input, input1, output, null); @@ -47,11 +49,13 @@ public MachineRecipe add(FluidStac public MachineRecipe add(FluidStack input, IIngredient input1, FluidStack output, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Fluid Canner recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Fluid Canner recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be empty").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty() + ) { return null; } MachineRecipe recipe = create(input, input1, output, tag); @@ -72,8 +76,10 @@ public void removeByOutput(FluidStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Fluid Canning recipe").add("output must not be empty").error().post(); return; } - for (Iterator> iterator = Recipes.cannerEnrich.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerEnrich.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (rec.getOutput().isFluidEqual(output) && rec.getOutput().amount == output.amount) { iterator.remove(); @@ -83,15 +89,19 @@ public void removeByOutput(FluidStack output) { } public void removeByInput(FluidStack input, ItemStack input1) { - if (GroovyLog.msg("Error removing Industrialcraft 2 Fluid Canning recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing Industrialcraft 2 Fluid Canning recipe").add(IngredientHelper.isEmpty(input), () -> "fluid input must not be empty").add( IngredientHelper.isEmpty(input1), () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } - for (Iterator> iterator = Recipes.cannerEnrich.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerEnrich.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (rec.getInput().fluid.getFluid() == input.getFluid() && rec.getInput().additive.matches(input1)) { iterator.remove(); @@ -101,8 +111,10 @@ public void removeByInput(FluidStack input, ItemStack input1) { } public void removeAll() { - for (Iterator> iterator = Recipes.cannerEnrich.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerEnrich.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -110,8 +122,10 @@ public void removeAll() { } private boolean remove(MachineRecipe recipe, boolean backup) { - for (Iterator> iterator = Recipes.cannerEnrich.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerEnrich.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (recipe.getInput().matches(rec.getInput().fluid, rec.getInput().additive.getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidGenerator.java index 88f75b37a..32f21ff3b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidGenerator.java @@ -30,11 +30,13 @@ public void onReload() { } public Pair add(FluidStack input, long energyPerMb, long energyPerTick) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Semi Fluid Generator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Semi Fluid Generator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( energyPerMb <= 0, () -> "energy per mb must be higher than zero") - .add(energyPerTick <= 0, () -> "energy per tick must be higher than zero").error().postIfNotEmpty()) { + .add(energyPerTick <= 0, () -> "energy per tick must be higher than zero").error().postIfNotEmpty() + ) { return null; } Pair pair = Pair.of(input.getFluid().getName(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidHeater.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidHeater.java index d178ea2f6..12df0d8bc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidHeater.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidHeater.java @@ -30,11 +30,13 @@ public void onReload() { } public Pair add(FluidStack input, int heat) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Fluid Heat Generator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Fluid Heat Generator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( heat <= 0, () -> "heat must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } return add(input.getFluid().getName(), new IFluidHeatManager.BurnProperty(input.amount, heat)); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/LiquidHeatExchanger.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/LiquidHeatExchanger.java index 349b0e1aa..fe072d3ee 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/LiquidHeatExchanger.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/LiquidHeatExchanger.java @@ -38,11 +38,13 @@ public void onReload() { } public HeatExchangerRecipe add(FluidStack hotFluid, FluidStack coldFluid, int huPerMB) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), () -> "hot fluid must not be empty") .add(IngredientHelper.isEmpty(coldFluid), () -> "cold fluid must not be empty").add(huPerMB <= 0, () -> "heat per mb must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } addCooldown(hotFluid, coldFluid, huPerMB); @@ -50,11 +52,13 @@ public HeatExchangerRecipe add(FluidStack hotFluid, FluidStack coldFluid, int hu } public HeatExchangerRecipe addHeatup(FluidStack coldFluid, FluidStack hotFluid, int huPerMB) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), () -> "hot fluid must not be empty") .add(IngredientHelper.isEmpty(coldFluid), () -> "cold fluid must not be empty").add(huPerMB <= 0, () -> "heat per mb must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } Recipes.liquidHeatupManager.getHeatExchangeProperties().put(coldFluid.getFluid().getName(), @@ -66,11 +70,13 @@ public HeatExchangerRecipe addHeatup(FluidStack coldFluid, FluidStack hotFluid, } public HeatExchangerRecipe addCooldown(FluidStack hotFluid, FluidStack coldFluid, int huPerMB) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Liquid Heat Exchanger recipe").add(IngredientHelper.isEmpty(hotFluid), () -> "hot fluid must not be empty") .add(IngredientHelper.isEmpty(coldFluid), () -> "cold fluid must not be empty").add(huPerMB <= 0, () -> "heat per mb must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } Recipes.liquidCooldownManager.getHeatExchangeProperties().put(hotFluid.getFluid().getName(), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Macerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Macerator.java index 5f8352d56..722b9c732 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Macerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Macerator.java @@ -29,11 +29,13 @@ public void add(MachineRecipe> recipe) { } public MachineRecipe> add(ItemStack output, IIngredient input) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -43,11 +45,13 @@ public MachineRecipe> add(ItemStack output, } public MachineRecipe> add(ItemStack output, IIngredient input, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Macerator recipe").add(IngredientHelper.isEmpty(input), () -> "input must not be empty").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return null; } MachineRecipe> recipe = new MachineRecipe<>(new RecipeInput(input), Collections @@ -70,8 +74,10 @@ public void removeByOutput(ItemStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Macerator recipe").add("output must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.macerator.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.macerator.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> recipe = iterator.next(); if (ItemStack.areItemStacksEqual((ItemStack) recipe.getOutput().toArray()[0], output)) { iterator.remove(); @@ -85,8 +91,10 @@ public void removeByInput(ItemStack input) { GroovyLog.msg("Error removing Industrialcraft 2 Macerator recipe").add("input must not be empty").error().post(); return; } - for (Iterator>> iterator = Recipes.macerator.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.macerator.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> recipe = iterator.next(); if (recipe.getInput().matches(input)) { iterator.remove(); @@ -96,8 +104,10 @@ public void removeByInput(ItemStack input) { } public void removeAll() { - for (Iterator>> iterator = Recipes.macerator.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.macerator.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -105,8 +115,10 @@ public void removeAll() { } private boolean remove(MachineRecipe> recipe, boolean backup) { - for (Iterator>> iterator = Recipes.macerator.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator>> iterator = Recipes.macerator.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe> rec = iterator.next(); if (rec.getInput().matches(recipe.getInput().getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Recycler.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Recycler.java index 8f68d5d3b..19b229c84 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Recycler.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Recycler.java @@ -36,11 +36,13 @@ public void onReload() { } public void addBlacklist(IIngredient ingredient) { - if (GroovyLog.msg("Error setting Recycler recipe").add(IngredientHelper.isEmpty(ingredient), + if ( + GroovyLog.msg("Error setting Recycler recipe").add(IngredientHelper.isEmpty(ingredient), () -> "ingredient must not be empty").add( !Recipes.recyclerWhitelist.isEmpty(), () -> "whitelist should be empty to set blacklist for Recycler") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } this.type = 1; @@ -50,11 +52,13 @@ public void addBlacklist(IIngredient ingredient) { } public void addWhitelist(IIngredient ingredient) { - if (GroovyLog.msg("Error setting Recycler recipe").add(IngredientHelper.isEmpty(ingredient), + if ( + GroovyLog.msg("Error setting Recycler recipe").add(IngredientHelper.isEmpty(ingredient), () -> "ingredient must not be empty").add( !Recipes.recyclerBlacklist.isEmpty(), () -> "blacklist should be empty to set whitelist for Recycler") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } this.type = 0; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Scrapbox.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Scrapbox.java index bb38142a4..527aa095f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Scrapbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Scrapbox.java @@ -21,10 +21,12 @@ public void onReload() { } public void add(ItemStack stack, float chance) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Scrapbox recipe").add(IngredientHelper.isEmpty(stack), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Scrapbox recipe").add(IngredientHelper.isEmpty(stack), () -> "stack must not be emtpy").add(chance <= 0, () -> "chance must be higher than zero") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } Drop drop = new Drop(stack, chance).setId(getDrops().size()); @@ -43,7 +45,9 @@ public void removeAll() { } @GroovyBlacklist - public List getDrops() { return ((ScrapboxRecipeManagerAccessor) Recipes.scrapboxDrops).getDrops(); } + public List getDrops() { + return ((ScrapboxRecipeManagerAccessor) Recipes.scrapboxDrops).getDrops(); + } public static class Drop { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/SolidCanner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/SolidCanner.java index 189dec775..1a7d55b9f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/SolidCanner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/SolidCanner.java @@ -32,11 +32,13 @@ public void add(MachineRecipe recip public MachineRecipe add(IIngredient input, IIngredient input1, ItemStack output) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Solid Canner recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Solid Canner recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be emtpy").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty() + ) { return null; } MachineRecipe recipe = create(input, input1, output, null); @@ -46,11 +48,13 @@ public MachineRecipe add(IIngredien public MachineRecipe add(IIngredient input, IIngredient input1, ItemStack output, NBTTagCompound tag) { - if (GroovyLog.msg("Error adding Industrialcraft 2 Solid Canner recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Industrialcraft 2 Solid Canner recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be emtpy").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(output), () -> "output must not be empty").error().postIfNotEmpty() + ) { return null; } MachineRecipe recipe = create(input, input1, output, tag); @@ -71,8 +75,10 @@ public void removeByOutput(ItemStack output) { GroovyLog.msg("Error removing Industrialcraft 2 Solid Canning recipe").add("output must not be empty").error().post(); return; } - for (Iterator> iterator = Recipes.cannerBottle.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerBottle.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (ItemStack.areItemStacksEqual(rec.getOutput(), output)) { iterator.remove(); @@ -82,15 +88,19 @@ public void removeByOutput(ItemStack output) { } public void removeByInput(ItemStack input, ItemStack input1) { - if (GroovyLog.msg("Error removing industrialcraft 2 Solid Canning recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing industrialcraft 2 Solid Canning recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be empty").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } - for (Iterator> iterator = Recipes.cannerBottle.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerBottle.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (rec.getInput().container.matches(input) && rec.getInput().fill.matches(input1)) { iterator.remove(); @@ -100,8 +110,10 @@ public void removeByInput(ItemStack input, ItemStack input1) { } public void removeAll() { - for (Iterator> iterator = Recipes.cannerBottle.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerBottle.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); iterator.remove(); addBackup(rec); @@ -109,8 +121,10 @@ public void removeAll() { } private boolean remove(MachineRecipe recipe, boolean backup) { - for (Iterator> iterator = Recipes.cannerBottle.getRecipes() - .iterator(); iterator.hasNext();) { + for ( + Iterator> iterator = Recipes.cannerBottle.getRecipes() + .iterator(); iterator.hasNext(); + ) { MachineRecipe rec = iterator.next(); if (recipe.getInput().matches(rec.getInput().container.getInputs().get(0), rec.getInput().fill.getInputs().get(0))) { iterator.remove(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/AlloyKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/AlloyKiln.java index 69b221663..69d33c29e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/AlloyKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/AlloyKiln.java @@ -74,11 +74,13 @@ public void removeByOutput(ItemStack output) { @MethodDescription(example = @Example("item('minecraft:gold_ingot'), item('immersiveengineering:metal:3')")) public void removeByInput(ItemStack input, ItemStack input1) { - if (GroovyLog.msg("Error removing Immersive Engineering Alloy Kiln recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing Immersive Engineering Alloy Kiln recipe").add(IngredientHelper.isEmpty(input), () -> "input 1 must not be empty").add( IngredientHelper.isEmpty(input1), () -> "input 2 must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } AlloyRecipe recipe = AlloyRecipe.findRecipe(input, input1); @@ -114,7 +116,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Alloy Kiln recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Alloy Kiln recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ArcFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ArcFurnace.java index 17cc27c3d..b8648bb2b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ArcFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ArcFurnace.java @@ -199,7 +199,9 @@ public RecipeBuilder recycling() { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Arc Furnace recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Arc Furnace recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnace.java index 700bef0f0..71e9a18a8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnace.java @@ -120,7 +120,9 @@ public RecipeBuilder slag(ItemStack slag) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Blast Furnace recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Blast Furnace recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java index 2131b8b1f..e4090b977 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java @@ -98,7 +98,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Blast Furnace Fuel"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Blast Furnace Fuel"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlueprintCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlueprintCrafting.java index 6553011d3..f715f7429 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlueprintCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlueprintCrafting.java @@ -87,14 +87,16 @@ public void removeByCategory(String blueprintCategory) { @MethodDescription(example = @Example("'components', item('immersiveengineering:material:8')")) public void removeByOutput(String blueprintCategory, ItemStack output) { - if (GroovyLog.msg("Error removing Immersive Engineering Blueprint Crafting recipe").add( + if ( + GroovyLog.msg("Error removing Immersive Engineering Blueprint Crafting recipe").add( !BlueprintCraftingRecipe.recipeList.containsKey(blueprintCategory), () -> "category " + blueprintCategory + " does not exist").add( IngredientHelper.isEmpty(output), () -> "output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } if (!BlueprintCraftingRecipe.recipeList.get(blueprintCategory).removeIf(recipe -> { @@ -111,14 +113,16 @@ public void removeByOutput(String blueprintCategory, ItemStack output) { @MethodDescription(example = @Example("'components', item('immersiveengineering:metal:38'), item('immersiveengineering:metal:38'), item('immersiveengineering:metal')")) public void removeByInput(String blueprintCategory, ItemStack... inputs) { - if (GroovyLog.msg("Error removing Immersive Engineering Blueprint Crafting recipe").add( + if ( + GroovyLog.msg("Error removing Immersive Engineering Blueprint Crafting recipe").add( !BlueprintCraftingRecipe.recipeList.containsKey(blueprintCategory), () -> "category " + blueprintCategory + " does not exist").add( inputs == null || inputs.length == 0, () -> "input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } @@ -182,7 +186,9 @@ public RecipeBuilder category(String category) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Blueprint recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Blueprint recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java index 8ea22077b..b1334a002 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java @@ -83,9 +83,11 @@ public void removeByOutput(ItemStack output) { @MethodDescription(example = @Example("item('minecraft:sponge'), fluid('water') * 1000")) public void removeByInput(ItemStack input, FluidStack inputFluid) { - if (GroovyLog.msg("Error removing Immersive Engineering Bottling Machine recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing Immersive Engineering Bottling Machine recipe").add(IngredientHelper.isEmpty(input), () -> "item input must not be empty") - .add(IngredientHelper.isEmpty(inputFluid), () -> "fluid input must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(inputFluid), () -> "fluid input must not be empty").error().postIfNotEmpty() + ) { return; } List recipes = BottlingMachineRecipe.recipeList.stream().filter(r -> ApiUtils.stackMatchesObject( @@ -118,7 +120,9 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Bottling recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Bottling recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java index cc56f2787..9058ffcda 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java @@ -119,7 +119,9 @@ public RecipeBuilder creosote(int creosote) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Coke Oven recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Coke Oven recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Crusher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Crusher.java index 47ba0dbb8..814186bec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Crusher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Crusher.java @@ -124,7 +124,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Crusher recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Crusher recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Excavator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Excavator.java index 4b566d10a..bb18fa4f9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Excavator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Excavator.java @@ -212,7 +212,9 @@ public RecipeBuilder blacklist() { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Excavator entry"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Excavator entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Fermenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Fermenter.java index d24425e6f..425e65dfd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Fermenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Fermenter.java @@ -115,7 +115,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Fermenter recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Fermenter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ImmersiveEngineering.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ImmersiveEngineering.java index 99b76a57f..2ec92f1fa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ImmersiveEngineering.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/ImmersiveEngineering.java @@ -30,11 +30,15 @@ public class ImmersiveEngineering extends GroovyPropertyContainer { public final Squeezer squeezer = new Squeezer(); public static IngredientStack toIngredientStack(IIngredient ingredient) { - if (IngredientHelper.isItem(ingredient)) { return new IngredientStack(IngredientHelper.toItemStack(ingredient).copy()); } + if (IngredientHelper.isItem(ingredient)) { + return new IngredientStack(IngredientHelper.toItemStack(ingredient).copy()); + } if (ingredient instanceof OreDictIngredient) { return new IngredientStack(((OreDictIngredient) ingredient).getOreDict(), ingredient.getAmount()); } - if (ingredient instanceof FluidStack) { return new IngredientStack(((FluidStack) ingredient).copy()); } + if (ingredient instanceof FluidStack) { + return new IngredientStack(((FluidStack) ingredient).copy()); + } return new IngredientStack(Arrays.asList(ingredient.getMatchingStacks()), ingredient.getAmount()); } @@ -48,7 +52,9 @@ public static boolean areIngredientsEquals(IIngredient target, IngredientStack o } public static Object toIEInput(IIngredient ingredient) { - if (ingredient instanceof OreDictIngredient) { return ((OreDictIngredient) ingredient).getOreDict(); } + if (ingredient instanceof OreDictIngredient) { + return ((OreDictIngredient) ingredient).getOreDict(); + } ItemStack[] matchingStacks = ingredient.getMatchingStacks(); return matchingStacks.length == 0 ? ItemStack.EMPTY : matchingStacks[0]; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/MetalPress.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/MetalPress.java index fc659bcb8..c2e495aac 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/MetalPress.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/MetalPress.java @@ -193,7 +193,9 @@ public RecipeBuilder mold(ItemStack mold) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Metal Press recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Metal Press recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Mixer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Mixer.java index 1a4668ccb..34dc8aa36 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Mixer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Mixer.java @@ -59,9 +59,11 @@ public boolean remove(MixerRecipe recipe) { @MethodDescription(example = @Example("fluid('potion').withNbt([Potion:'minecraft:night_vision'])")) public void removeByOutput(FluidStack fluidOutput) { - if (GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(IngredientHelper.isEmpty(fluidOutput), + if ( + GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(IngredientHelper.isEmpty(fluidOutput), () -> "fluid output must not be empty").error() - .postIfNotEmpty()) { + .postIfNotEmpty() + ) { return; } if (!MixerRecipe.recipeList.removeIf(recipe -> { @@ -78,9 +80,11 @@ public void removeByOutput(FluidStack fluidOutput) { @MethodDescription(example = @Example("item('minecraft:sand'), item('minecraft:sand'), item('minecraft:clay_ball'), item('minecraft:gravel')")) public void removeByInput(IIngredient... itemInputs) { - if (GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(itemInputs == null || itemInputs.length == 0, + if ( + GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(itemInputs == null || itemInputs.length == 0, () -> "item input must not be empty").error() - .postIfNotEmpty()) { + .postIfNotEmpty() + ) { return; } List recipes = MixerRecipe.recipeList.stream().filter(r -> r.itemInputs.length == itemInputs.length && Arrays @@ -101,11 +105,13 @@ public void removeByInput(IIngredient... itemInputs) { @MethodDescription(example = @Example("fluid('water'), item('minecraft:speckled_melon')")) public void removeByInput(FluidStack fluidInput, IIngredient... itemInput) { - if (GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(IngredientHelper.isEmpty(fluidInput), + if ( + GroovyLog.msg("Error removing Immersive Engineering Mixer recipe").add(IngredientHelper.isEmpty(fluidInput), () -> "fluid input must not be empty").add( itemInput == null || itemInput.length == 0, () -> "item input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } List recipes = MixerRecipe.recipeList.stream().filter(r -> fluidInput.isFluidEqual( @@ -151,7 +157,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Mixer recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Mixer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Refinery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Refinery.java index e8b74bcb7..288b42e43 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Refinery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Refinery.java @@ -74,9 +74,11 @@ public void removeByOutput(FluidStack fluidOutput) { @MethodDescription(example = @Example("fluid('plantoil'), fluid('ethanol')")) public void removeByInput(FluidStack input0, FluidStack input1) { - if (GroovyLog.msg("Error removing Immersive Engineering Refinery recipe").add(IngredientHelper.isEmpty(input0), + if ( + GroovyLog.msg("Error removing Immersive Engineering Refinery recipe").add(IngredientHelper.isEmpty(input0), () -> "fluid input 1 must not be empty") - .add(IngredientHelper.isEmpty(input1), () -> "fluid input 2 must not be empty").error().postIfNotEmpty()) { + .add(IngredientHelper.isEmpty(input1), () -> "fluid input 2 must not be empty").error().postIfNotEmpty() + ) { return; } List recipes = RefineryRecipe.recipeList.stream().filter(r -> (r.input0.isFluidEqual(input0) && r.input1 @@ -115,7 +117,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Refinery recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Refinery recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Squeezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Squeezer.java index 1bccffe5e..8b940fa3f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Squeezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/Squeezer.java @@ -81,11 +81,13 @@ public void removeByOutput(FluidStack fluidOutput) { @MethodDescription public void removeByOutput(FluidStack fluidOutput, ItemStack itemOutput) { - if (GroovyLog.msg("Error removing Immersive Engineering Squeezer recipe").add(IngredientHelper.isEmpty(fluidOutput), + if ( + GroovyLog.msg("Error removing Immersive Engineering Squeezer recipe").add(IngredientHelper.isEmpty(fluidOutput), () -> "fluid output must not be empty").add( IngredientHelper.isEmpty(itemOutput), () -> "item input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } List recipes = SqueezerRecipe.recipeList.stream().filter(r -> fluidOutput.isFluidEqual( @@ -102,9 +104,11 @@ public void removeByOutput(FluidStack fluidOutput, ItemStack itemOutput) { @MethodDescription(example = @Example("item('immersiveengineering:material:18')")) public void removeByOutput(ItemStack itemOutput) { - if (GroovyLog.msg("Error removing Immersive Engineering Squeezer recipe").add(IngredientHelper.isEmpty(itemOutput), + if ( + GroovyLog.msg("Error removing Immersive Engineering Squeezer recipe").add(IngredientHelper.isEmpty(itemOutput), () -> "item input must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } // "Condition 'r.itemOutput != null' is always 'true'" is a lie. It can be null, and if it is it *will* throw an NPE if we don't check against it. @@ -160,7 +164,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Engineering Refinery recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Engineering Refinery recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Distillation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Distillation.java index 747d77c0c..16f817d05 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Distillation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Distillation.java @@ -132,7 +132,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Immersive Petroleum Distillation recipe"; } + public String getErrorMsg() { + return "Error adding Immersive Petroleum Distillation recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Reservoir.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Reservoir.java index 37efce7f8..e35f9aa36 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Reservoir.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivepetroleum/Reservoir.java @@ -210,7 +210,9 @@ public RecipeBuilder biomeBlacklist() { } @Override - public String getErrorMsg() { return "Error adding Immersive Petroleum Reservoir entry"; } + public String getErrorMsg() { + return "Error adding Immersive Petroleum Reservoir entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/LaserDrill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/LaserDrill.java index 8b875935e..e774a74d8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/LaserDrill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/LaserDrill.java @@ -237,7 +237,9 @@ public RecipeBuilder maxY(int maxY) { } @Override - public String getErrorMsg() { return "Error adding Industrial Foregoing Laser Drill Entry"; } + public String getErrorMsg() { + return "Error adding Industrial Foregoing Laser Drill Entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Straw.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Straw.java index bf6e3569b..44175edf0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Straw.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Straw.java @@ -69,10 +69,14 @@ public RecipeBuilder effect(Collection effects) { } @Override - public String getErrorMsg() { return "Error adding Industrial Foregoing Straw Entry"; } + public String getErrorMsg() { + return "Error adding Industrial Foregoing Straw Entry"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_straw_entry_"; } + public String getRecipeNamePrefix() { + return "groovyscript_straw_entry_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/AnvilSmashing.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/AnvilSmashing.java index 9c7b7769d..42f9f56dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/AnvilSmashing.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/AnvilSmashing.java @@ -82,9 +82,11 @@ public boolean remove(Material material) { @MethodDescription public void removeByInput(IBlockState input) { - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() - .filter(r -> r.getKey().equals(input)) - .collect(Collectors.toList())) { + for ( + Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() + .filter(r -> r.getKey().equals(input)) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(recipe.getKey(), recipe.getValue())); InspirationsRegistryAccessor.getAnvilSmashing().remove(recipe.getKey(), recipe.getValue()); } @@ -92,9 +94,11 @@ public void removeByInput(IBlockState input) { @MethodDescription(example = @Example("blockstate('minecraft:packed_ice')")) public void removeByInput(Block input) { - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashingBlocks().entrySet().stream() - .filter(r -> r.getKey().equals(input)).collect( - Collectors.toList())) { + for ( + Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashingBlocks().entrySet().stream() + .filter(r -> r.getKey().equals(input)).collect( + Collectors.toList()) + ) { blockStorage.addBackup(Pair.of(recipe.getKey(), recipe.getValue())); InspirationsRegistryAccessor.getAnvilSmashingBlocks().remove(recipe.getKey(), recipe.getValue()); } @@ -102,15 +106,19 @@ public void removeByInput(Block input) { @MethodDescription(example = @Example("blockstate('minecraft:cobblestone')")) public void removeByOutput(IBlockState output) { - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() - .filter(r -> r.getValue().equals(output)) - .collect(Collectors.toList())) { + for ( + Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() + .filter(r -> r.getValue().equals(output)) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(recipe.getKey(), recipe.getValue())); InspirationsRegistryAccessor.getAnvilSmashing().remove(recipe.getKey(), recipe.getValue()); } - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashingBlocks().entrySet().stream() - .filter(r -> r.getValue().equals(output)).collect( - Collectors.toList())) { + for ( + Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashingBlocks().entrySet().stream() + .filter(r -> r.getValue().equals(output)).collect( + Collectors.toList()) + ) { blockStorage.addBackup(Pair.of(recipe.getKey(), recipe.getValue())); InspirationsRegistryAccessor.getAnvilSmashingBlocks().remove(recipe.getKey(), recipe.getValue()); } @@ -162,7 +170,9 @@ public RecipeBuilder output(IBlockState output) { } @Override - public String getErrorMsg() { return "Error adding Inspirations Anvil Smashing recipe"; } + public String getErrorMsg() { + return "Error adding Inspirations Anvil Smashing recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java index 8afb90a16..ee3f69b5a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java @@ -138,13 +138,15 @@ public boolean remove(ICauldronRecipe recipe) { @MethodDescription(example = @Example("item('minecraft:ghast_tear')")) public void removeByInput(IIngredient input) { - for (ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( - r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, - input, - null, - null, - null)) - .collect(Collectors.toList())) { + for ( + ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( + r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, + input, + null, + null, + null)) + .collect(Collectors.toList()) + ) { addBackup(recipe); InspirationsRegistryAccessor.getCauldronRecipes().remove(recipe); } @@ -152,13 +154,15 @@ public void removeByInput(IIngredient input) { @MethodDescription(example = @Example("item('minecraft:piston')")) public void removeByOutput(ItemStack output) { - for (ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( - r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, - null, - output, - null, - null)) - .collect(Collectors.toList())) { + for ( + ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( + r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, + null, + output, + null, + null)) + .collect(Collectors.toList()) + ) { addBackup(recipe); InspirationsRegistryAccessor.getCauldronRecipes().remove(recipe); } @@ -166,13 +170,15 @@ public void removeByOutput(ItemStack output) { @MethodDescription public void removeByFluidInput(Fluid input) { - for (ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( - r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, - null, - null, - input, - null)) - .collect(Collectors.toList())) { + for ( + ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( + r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, + null, + null, + input, + null)) + .collect(Collectors.toList()) + ) { addBackup(recipe); InspirationsRegistryAccessor.getCauldronRecipes().remove(recipe); } @@ -185,13 +191,15 @@ public void removeByFluidInput(FluidStack input) { @MethodDescription public void removeByFluidOutput(Fluid output) { - for (ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( - r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, - null, - null, - null, - output)) - .collect(Collectors.toList())) { + for ( + ICauldronRecipe recipe : InspirationsRegistryAccessor.getCauldronRecipes().stream().filter( + r -> r instanceof ISimpleCauldronRecipe && checkRecipeMatches((ISimpleCauldronRecipe) r, + null, + null, + null, + output)) + .collect(Collectors.toList()) + ) { addBackup(recipe); InspirationsRegistryAccessor.getCauldronRecipes().remove(recipe); } @@ -342,7 +350,9 @@ public RecipeBuilder sound(String sound) { } @Override - public String getErrorMsg() { return "Error adding Inspirations Cauldron recipe"; } + public String getErrorMsg() { + return "Error adding Inspirations Cauldron recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java index 8d676a3ee..0186771f5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java @@ -24,7 +24,9 @@ public class DryingBasin extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(BlockDryingBasinConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(BlockDryingBasinConfig.class); + } @RecipeBuilderDescription(example = {@Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:clay')).fluidInput(fluid('water') * 500).fluidOutput(fluid('lava') * 2000).mechanical().duration(5)"), @Example(".output(item('minecraft:clay')).fluidInput(fluid('water') * 2000)")}, @@ -131,7 +133,9 @@ public RecipeBuilder duration(int duration) { } @Override - public String getErrorMsg() { return "Error adding Integrated Dynamics Drying Basin Recipe"; } + public String getErrorMsg() { + return "Error adding Integrated Dynamics Drying Basin Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalDryingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalDryingBasin.java index c2a2bed7f..511ead5b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalDryingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalDryingBasin.java @@ -18,7 +18,9 @@ public class MechanicalDryingBasin extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(BlockMechanicalDryingBasinConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(BlockMechanicalDryingBasinConfig.class); + } @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).fluidInput(fluid('water') * 50).fluidOutput(fluid('lava') * 20000).duration(300)"), requirement = @Property(property = "mechanical", defaultValue = "true")) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalSqueezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalSqueezer.java index 43a0f6a17..135550a16 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalSqueezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/MechanicalSqueezer.java @@ -19,7 +19,9 @@ public class MechanicalSqueezer extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(BlockMechanicalSqueezerConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(BlockMechanicalSqueezerConfig.class); + } @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:clay') * 16, 0.9F)"), requirement = @Property(property = "mechanical", defaultValue = "true")) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java index 90cc26e64..f20222178 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java @@ -28,7 +28,9 @@ public class Squeezer extends VirtualizedRegistry> { @Override - public boolean isEnabled() { return Configs.isEnabled(BlockSqueezerConfig.class); } + public boolean isEnabled() { + return Configs.isEnabled(BlockSqueezerConfig.class); + } @RecipeBuilderDescription(example = {@Example(".input(item('minecraft:clay')).output(item('minecraft:clay_ball'), 1F).output(item('minecraft:clay_ball') * 2, 0.7F).output(item('minecraft:clay_ball') * 10, 0.2F).fluidOutput(fluid('lava') * 2000).mechanical().duration(5)"), @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:clay'), 0.5F)"), @@ -146,7 +148,9 @@ public RecipeBuilder duration(int duration) { } @Override - public String getErrorMsg() { return "Error adding Integrated Dynamics Squeezer Recipe"; } + public String getErrorMsg() { + return "Error adding Integrated Dynamics Squeezer Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/BaseCategory.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/BaseCategory.java index 3f46e7f16..ba8ac83aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/BaseCategory.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/BaseCategory.java @@ -35,16 +35,24 @@ public BaseCategory(IGuiHelper guiHelper, String uid, int width, int height) { } @Override - public @NotNull String getUid() { return this.uid; } + public @NotNull String getUid() { + return this.uid; + } @Override - public @NotNull String getTitle() { return I18n.format(GroovyScript.ID + ".jei.category." + this.uid + ".name"); } + public @NotNull String getTitle() { + return I18n.format(GroovyScript.ID + ".jei.category." + this.uid + ".name"); + } @Override - public @NotNull String getModName() { return GroovyScript.NAME; } + public @NotNull String getModName() { + return GroovyScript.NAME; + } @Override - public @NotNull IDrawable getBackground() { return this.background; } + public @NotNull IDrawable getBackground() { + return this.background; + } public static void addItemSlot(IRecipeLayout recipeLayout, int index, boolean input, int x, int y) { recipeLayout.getItemStacks().init(index, input, x, y); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Description.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Description.java index 9c2c59b47..f3d813739 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Description.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Description.java @@ -54,8 +54,10 @@ public void applyRemovals(IRecipeRegistry recipeRegistry) { if (!VanillaTypes.ITEM.equals(accessor.getIngredientType())) return; for (Pair, List> entry : this.getBackupRecipes()) { - if (entry.getKey().stream().anyMatch(x -> accessor.getIngredients().stream().anyMatch( - a -> a instanceof ItemStack && x.test((ItemStack) a)))) { + if ( + entry.getKey().stream().anyMatch(x -> accessor.getIngredients().stream().anyMatch( + a -> a instanceof ItemStack && x.test((ItemStack) a))) + ) { recipeRegistry.hideRecipe(wrapper, VanillaRecipeCategoryUid.INFORMATION); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JeiPlugin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JeiPlugin.java index 316aec7e8..d0466add3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JeiPlugin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JeiPlugin.java @@ -47,7 +47,9 @@ public class JeiPlugin implements IModPlugin { public static IIngredientRenderer fluidRenderer; - public static boolean isLoaded() { return jeiRuntime != null; } + public static boolean isLoaded() { + return jeiRuntime != null; + } @Override public void registerCategories(IRecipeCategoryRegistration registry) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/ShapedRecipeWrapper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/ShapedRecipeWrapper.java index 5c67bd617..cd2192ec0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/ShapedRecipeWrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/ShapedRecipeWrapper.java @@ -16,8 +16,12 @@ public ShapedRecipeWrapper(IJeiHelpers jeiHelpers, IShapedRecipe recipe) { } @Override - public int getWidth() { return recipe.getRecipeWidth(); } + public int getWidth() { + return recipe.getRecipeWidth(); + } @Override - public int getHeight() { return recipe.getRecipeHeight(); } + public int getHeight() { + return recipe.getRecipeHeight(); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java index 0d0259985..76f4de6e2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java @@ -78,7 +78,9 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Lazy AE2 Aggregator recipe"; } + public String getErrorMsg() { + return "Error adding Lazy AE2 Aggregator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java index fcb7f14a7..6b275de1a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java @@ -76,7 +76,9 @@ public void removeAll() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Lazy AE2 Centrifuge recipe"; } + public String getErrorMsg() { + return "Error adding Lazy AE2 Centrifuge recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java index 0f64b85ea..c6d87d276 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java @@ -85,7 +85,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Lazy AE2 Energizer recipe"; } + public String getErrorMsg() { + return "Error adding Lazy AE2 Energizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java index 94e0c8ced..e14499778 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java @@ -93,7 +93,9 @@ public RecipeBuilder bottom(IIngredient bottom) { } @Override - public String getErrorMsg() { return "Error adding Lazy AE2 Etcher recipe"; } + public String getErrorMsg() { + return "Error adding Lazy AE2 Etcher recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalInfuser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalInfuser.java index 54321604a..dbb727f6d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalInfuser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalInfuser.java @@ -60,7 +60,9 @@ public boolean removeByInput(GasStack leftInput, GasStack rightInput) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Chemical Infuser recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Chemical Infuser recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalOxidizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalOxidizer.java index da9a514ea..084f80321 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalOxidizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ChemicalOxidizer.java @@ -72,7 +72,9 @@ public boolean removeByInput(IIngredient ingredient) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Chemical Oxidizer recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Chemical Oxidizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Combiner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Combiner.java index 5ffc31899..818812bbe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Combiner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Combiner.java @@ -82,7 +82,9 @@ public RecipeBuilder extra(ItemStack extra) { } @Override - public String getErrorMsg() { return "Error adding Mekanism Combiner recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Combiner recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crusher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crusher.java index 89e7c92b5..b8df147ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crusher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crusher.java @@ -70,7 +70,9 @@ public boolean removeByInput(IIngredient ingredient) { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Crusher recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Crusher recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crystallizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crystallizer.java index e358b9364..97c77755c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crystallizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Crystallizer.java @@ -61,7 +61,9 @@ public boolean removeByInput(GasStack input) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Crystallizer recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Crystallizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/DissolutionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/DissolutionChamber.java index db2ce56e7..ede0b4382 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/DissolutionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/DissolutionChamber.java @@ -72,7 +72,9 @@ public boolean removeByInput(IIngredient ingredient) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Dissolution Chamber recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Dissolution Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ElectrolyticSeparator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ElectrolyticSeparator.java index 7459f8436..9ab582f28 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ElectrolyticSeparator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ElectrolyticSeparator.java @@ -73,7 +73,9 @@ public RecipeBuilder energy(double energy) { } @Override - public String getErrorMsg() { return "Error adding Mekanism Electrolytic Separator recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Electrolytic Separator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/EnrichmentChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/EnrichmentChamber.java index a352e6edc..4ae5e15ac 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/EnrichmentChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/EnrichmentChamber.java @@ -71,7 +71,9 @@ public boolean removeByInput(IIngredient ingredient) { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Enrichment Chamber recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Enrichment Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java index c4e605e67..eb6a1af0d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Infusion.java @@ -97,8 +97,10 @@ public void add(InfuseType type, int amount, ItemStack item) { @MethodDescription(type = MethodDescription.Type.ADDITION) public void add(InfuseType type, int amount, IIngredient... ingredients) { - for (ItemStack item : Arrays.stream(ingredients).flatMap(g -> Arrays.stream(g.getMatchingStacks())).collect(Collectors - .toList())) { + for ( + ItemStack item : Arrays.stream(ingredients).flatMap(g -> Arrays.stream(g.getMatchingStacks())).collect(Collectors + .toList()) + ) { add(type, amount, item); } } @@ -112,8 +114,9 @@ public void add(String type, int amount, IIngredient... ingredients) { @MethodDescription(type = MethodDescription.Type.ADDITION) public void add(InfuseType type, int amount, Collection ingredients) { - for (ItemStack item : ingredients.stream().flatMap(g -> Arrays.stream(g.getMatchingStacks())).collect(Collectors - .toList())) { + for ( + ItemStack item : ingredients.stream().flatMap(g -> Arrays.stream(g.getMatchingStacks())).collect(Collectors.toList()) + ) { add(type, amount, item); } } @@ -125,9 +128,11 @@ public void add(String type, int amount, Collection ingredients) { @MethodDescription(example = @Example("ore('dustDiamond')")) public void remove(IIngredient item) { - for (Map.Entry entry : InfuseRegistry.getObjectMap().entrySet().stream().filter(x -> item.test(x - .getKey())) - .collect(Collectors.toList())) { + for ( + Map.Entry entry : InfuseRegistry.getObjectMap().entrySet().stream().filter(x -> item.test(x + .getKey())) + .collect(Collectors.toList()) + ) { objectStorage.addBackup(Pair.of(entry.getKey(), entry.getValue())); InfuseRegistry.getObjectMap().remove(entry.getKey()); } @@ -150,9 +155,11 @@ public void remove(Collection ingredients) { @MethodDescription(example = {@Example("infusionType('carbon')"), @Example(value = "infusionType('diamond')", commented = true)}) public void removeByType(InfuseType type) { - for (Map.Entry entry : InfuseRegistry.getObjectMap().entrySet().stream().filter(x -> x - .getValue().type == type) - .collect(Collectors.toList())) { + for ( + Map.Entry entry : InfuseRegistry.getObjectMap().entrySet().stream().filter(x -> x + .getValue().type == type) + .collect(Collectors.toList()) + ) { objectStorage.addBackup(Pair.of(entry.getKey(), entry.getValue())); InfuseRegistry.getObjectMap().remove(entry.getKey()); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/InjectionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/InjectionChamber.java index 1a12d227b..b2c73291e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/InjectionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/InjectionChamber.java @@ -78,7 +78,9 @@ public boolean removeByInput(IIngredient ingredient, GasStack gasInput) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Injection Chamber recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Injection Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/MetallurgicInfuser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/MetallurgicInfuser.java index 86dddfbcf..7332bbe2c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/MetallurgicInfuser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/MetallurgicInfuser.java @@ -111,7 +111,9 @@ public RecipeBuilder amount(int amount) { } @Override - public String getErrorMsg() { return "Error adding Mekanism Metallurgic Infuser recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Metallurgic Infuser recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/OsmiumCompressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/OsmiumCompressor.java index 46f3d76d4..d75e89ccb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/OsmiumCompressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/OsmiumCompressor.java @@ -82,7 +82,9 @@ public boolean removeByInput(IIngredient ingredient, GasStack gasInput) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Osmium Compressor recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Osmium Compressor recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PressurizedReactionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PressurizedReactionChamber.java index 8d506cdba..0ada60ad6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PressurizedReactionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PressurizedReactionChamber.java @@ -50,13 +50,15 @@ public PressurizedRecipe add(IIngredient inputSolid, FluidStack inputFluid, GasS @MethodDescription(example = @Example("ore('logWood'), fluid('water'), gas('oxygen')")) public boolean removeByInput(IIngredient inputSolid, FluidStack inputFluid, GasStack inputGas) { - if (GroovyLog.msg("Error removing Mekanism Pressurized Reaction Chamber recipe").error().add(IngredientHelper.isEmpty( + if ( + GroovyLog.msg("Error removing Mekanism Pressurized Reaction Chamber recipe").error().add(IngredientHelper.isEmpty( inputSolid), () -> "item input must not be empty") .add(IngredientHelper.isEmpty(inputFluid), () -> "fluid input must not be empty").add(Mekanism.isEmpty( inputGas), () -> "input gas must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return false; } boolean found = false; @@ -98,7 +100,9 @@ public RecipeBuilder energy(double energy) { } @Override - public String getErrorMsg() { return "Error adding Mekanism Pressurized Reaction Chamber recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Pressurized Reaction Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PurificationChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PurificationChamber.java index 942e8319b..d0dc123d4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PurificationChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/PurificationChamber.java @@ -78,7 +78,9 @@ public boolean removeByInput(IIngredient ingredient, GasStack gasInput) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Purification Chamber recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Purification Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Sawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Sawmill.java index f67688a32..4370ee302 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Sawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Sawmill.java @@ -108,7 +108,9 @@ public RecipeBuilder chance(double chance) { } @Override - public String getErrorMsg() { return "Error adding Mekanism Sawmill recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Sawmill recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Smelting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Smelting.java index 6316178fb..b34744c0e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Smelting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Smelting.java @@ -75,7 +75,9 @@ public boolean removeByInput(IIngredient ingredient) { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Smelting recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Smelting recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/SolarNeutronActivator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/SolarNeutronActivator.java index bd34eb284..2566f5866 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/SolarNeutronActivator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/SolarNeutronActivator.java @@ -59,7 +59,9 @@ public boolean removeByInput(GasStack input) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Solar Neutron Activator recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Solar Neutron Activator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ThermalEvaporationPlant.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ThermalEvaporationPlant.java index 6b3a21e9d..2ba6b4c4e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ThermalEvaporationPlant.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/ThermalEvaporationPlant.java @@ -62,7 +62,9 @@ public boolean removeByInput(FluidStack input) { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Thermal Evaporation Plant recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Thermal Evaporation Plant recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Washer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Washer.java index d80950953..e45a4c354 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Washer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Washer.java @@ -59,7 +59,9 @@ public boolean removeByInput(GasStack input) { public static class RecipeBuilder extends GasRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Mekanism Washer recipe"; } + public String getErrorMsg() { + return "Error adding Mekanism Washer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasStackList.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasStackList.java index e6e509b95..1420d8f4f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasStackList.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasStackList.java @@ -16,7 +16,9 @@ public GasStackList(Collection collection) { } public GasStack getOrEmpty(int i) { - if (i < 0 || i >= size()) { return null; } + if (i < 0 || i >= size()) { + return null; + } return get(i); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/IngredientWrapper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/IngredientWrapper.java index 9a86e34de..88622135a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/IngredientWrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/IngredientWrapper.java @@ -31,15 +31,25 @@ public IngredientWrapper(IIngredient ingredient, String infuseType) { this.infuseType = infuseType == null ? "" : infuseType; } - public String getInfuseType() { return this.infuseType; } + public String getInfuseType() { + return this.infuseType; + } - public IIngredient getIngredient() { return this.left; } + public IIngredient getIngredient() { + return this.left; + } - public IIngredient getLeft() { return this.left; } + public IIngredient getLeft() { + return this.left; + } - public IIngredient getMiddle() { return this.middle; } + public IIngredient getMiddle() { + return this.middle; + } - public IIngredient getRight() { return this.right; } + public IIngredient getRight() { + return this.right; + } public int getAmount() { //TODO: Make this method actually do something if we ever need to use IntegerInput as an input type diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/MekanismIngredientHelper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/MekanismIngredientHelper.java index ca5544654..7a9b3ff2a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/MekanismIngredientHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/MekanismIngredientHelper.java @@ -37,18 +37,30 @@ public static boolean checkNotNull(String name, IIngredient... ingredients) { } private static IIngredient getIngredient(Object ingredient) { - if (ingredient instanceof IIngredient) { return (IIngredient) ingredient; } + if (ingredient instanceof IIngredient) { + return (IIngredient) ingredient; + } - if (ingredient instanceof Gas) { return (IIngredient) new GasStack((Gas) ingredient, 1); } - if (ingredient instanceof Fluid) { return (IIngredient) new FluidStack((Fluid) ingredient, 1); } + if (ingredient instanceof Gas) { + return (IIngredient) new GasStack((Gas) ingredient, 1); + } + if (ingredient instanceof Fluid) { + return (IIngredient) new FluidStack((Fluid) ingredient, 1); + } //TODO: Support other types of things like ore dict return IIngredient.ANY; } public static boolean matches(IIngredient input, IIngredient toMatch) { - if (input instanceof GasStack) { return matches(toMatch, (GasStack) input); } - if (IngredientHelper.isItem(input)) { return toMatch != null && toMatch.test(IngredientHelper.toItemStack(input)); } - if (input instanceof FluidStack) { return toMatch != null && toMatch.test((FluidStack) input); } + if (input instanceof GasStack) { + return matches(toMatch, (GasStack) input); + } + if (IngredientHelper.isItem(input)) { + return toMatch != null && toMatch.test(IngredientHelper.toItemStack(input)); + } + if (input instanceof FluidStack) { + return toMatch != null && toMatch.test((FluidStack) input); + } //TODO: Support other types of things like ore dict return false; } @@ -125,14 +137,22 @@ public static IMekanismIngredient getMekanismIngredient(IIngredient i if (ingredient instanceof OreDictIngredient) { return new OredictMekIngredient(((OreDictIngredient) ingredient).getOreDict()); } - if (IngredientHelper.isItem(ingredient)) { return new ItemStackMekIngredient(IngredientHelper.toItemStack(ingredient)); } + if (IngredientHelper.isItem(ingredient)) { + return new ItemStackMekIngredient(IngredientHelper.toItemStack(ingredient)); + } return new IngredientMekIngredientWrapper(ingredient.toMcIngredient()); } public static boolean matches(IIngredient ingredient, GasStack gasStack) { - if (ingredient == null) { return false; } - if (ingredient == IIngredient.ANY) { return true; } - if (ingredient instanceof GasStack) { return ((GasStack) ingredient).isGasEqual(gasStack); } + if (ingredient == null) { + return false; + } + if (ingredient == IIngredient.ANY) { + return true; + } + if (ingredient instanceof GasStack) { + return ((GasStack) ingredient).isGasEqual(gasStack); + } return false; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java index 3502e12f1..8c0ebb930 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java @@ -136,10 +136,14 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Nature's Aura Altar Recipe"; } + public String getErrorMsg() { + return "Error adding Nature's Aura Altar Recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_altar_"; } + public String getRecipeNamePrefix() { + return "groovyscript_altar_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java index 00011b210..f3b929e2f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java @@ -116,10 +116,14 @@ public RecipeBuilder catalyst(IIngredient catalyst) { } @Override - public String getErrorMsg() { return "Error adding Nature's Aura Offering Recipe"; } + public String getErrorMsg() { + return "Error adding Nature's Aura Offering Recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_offering_"; } + public String getRecipeNamePrefix() { + return "groovyscript_offering_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java index 7716f1cd9..aee7b2c07 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java @@ -129,10 +129,14 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Nature's Aura Ritual Recipe"; } + public String getErrorMsg() { + return "Error adding Nature's Aura Ritual Recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_ritual_"; } + public String getRecipeNamePrefix() { + return "groovyscript_ritual_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Spawning.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Spawning.java index b75fd2b01..8969d616a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Spawning.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Spawning.java @@ -142,10 +142,14 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Nature's Aura Spawning Recipe"; } + public String getErrorMsg() { + return "Error adding Nature's Aura Spawning Recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_spawning_"; } + public String getRecipeNamePrefix() { + return "groovyscript_spawning_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Amadron.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Amadron.java index 9f0c02d7a..2d048f9cc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Amadron.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Amadron.java @@ -79,13 +79,17 @@ public boolean remove(AmadronOffer recipe) { @MethodDescription(example = @Example("item('minecraft:emerald')")) public boolean removeByOutput(IIngredient output) { return AmadronOfferManager.getInstance().getStaticOffers().removeIf(entry -> { - if (entry.getOutput() instanceof FluidStack fluid && output.test(fluid) || entry.getOutput() instanceof ItemStack item && output.test(item)) { + if ( + entry.getOutput() instanceof FluidStack fluid && output.test(fluid) || entry.getOutput() instanceof ItemStack item && output.test(item) + ) { addBackup(entry); return true; } return false; }) | AmadronOfferManager.getInstance().getPeriodicOffers().removeIf(entry -> { - if (entry.getOutput() instanceof FluidStack fluid && output.test(fluid) || entry.getOutput() instanceof ItemStack item && output.test(item)) { + if ( + entry.getOutput() instanceof FluidStack fluid && output.test(fluid) || entry.getOutput() instanceof ItemStack item && output.test(item) + ) { periodicStorage.addBackup(entry); return true; } @@ -96,13 +100,17 @@ public boolean removeByOutput(IIngredient output) { @MethodDescription(example = @Example("item('minecraft:rotten_flesh')")) public boolean removeByInput(IIngredient input) { return AmadronOfferManager.getInstance().getStaticOffers().removeIf(entry -> { - if (entry.getInput() instanceof FluidStack fluid && input.test(fluid) || entry.getInput() instanceof ItemStack item && input.test(item)) { + if ( + entry.getInput() instanceof FluidStack fluid && input.test(fluid) || entry.getInput() instanceof ItemStack item && input.test(item) + ) { addBackup(entry); return true; } return false; }) | AmadronOfferManager.getInstance().getPeriodicOffers().removeIf(entry -> { - if (entry.getInput() instanceof FluidStack fluid && input.test(fluid) || entry.getInput() instanceof ItemStack item && input.test(item)) { + if ( + entry.getInput() instanceof FluidStack fluid && input.test(fluid) || entry.getInput() instanceof ItemStack item && input.test(item) + ) { periodicStorage.addBackup(entry); return true; } @@ -160,7 +168,9 @@ public RecipeBuilder periodic(boolean periodic) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Amadron recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Amadron recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/AssemblyController.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/AssemblyController.java index dd10c0a33..a09728e84 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/AssemblyController.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/AssemblyController.java @@ -151,7 +151,9 @@ public RecipeBuilder laser() { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Assembly Controller recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Assembly Controller recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java index 4ea6cbd87..80c8cd476 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java @@ -55,8 +55,10 @@ public boolean removeByOutput(IIngredient output) { @MethodDescription(example = @Example(value = "item('minecraft:iron_block')", commented = true)) public boolean removeByInput(IIngredient input) { return ExplosionCraftingRecipe.recipes.removeIf(entry -> { - if (input.test(entry.getInput()) || input instanceof OreDictIngredient oreDictIngredient && oreDictIngredient.getOreDict() - .equals(entry.getOreDictKey())) { + if ( + input.test(entry.getInput()) || input instanceof OreDictIngredient oreDictIngredient && oreDictIngredient.getOreDict() + .equals(entry.getOreDictKey()) + ) { addBackup(entry); return true; } @@ -88,7 +90,9 @@ public RecipeBuilder lossRate(int lossRate) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Explosion recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Explosion recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java index dcf393260..740eb690a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java @@ -74,7 +74,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Heat Frame Cooling recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Heat Frame Cooling recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/LiquidFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/LiquidFuel.java index 38caf8768..65ebce10e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/LiquidFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/LiquidFuel.java @@ -80,7 +80,9 @@ public RecipeBuilder pressure(int pressure) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Liquid Fuel entry"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Liquid Fuel entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java index da8954db6..a324a2a3b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java @@ -152,7 +152,9 @@ public RecipeBuilder useDye(boolean useDye) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Plastic Mixer recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Plastic Mixer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PressureChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PressureChamber.java index 242407a38..b43e65ef0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PressureChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PressureChamber.java @@ -92,7 +92,9 @@ public RecipeBuilder pressure(float pressure) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Pressure Chamber recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Pressure Chamber recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Refinery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Refinery.java index 71605acda..ac35e9eaf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Refinery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Refinery.java @@ -89,7 +89,9 @@ public RecipeBuilder requiredTemperature(int requiredTemperature) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Refinery recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Refinery recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/ThermopneumaticProcessingPlant.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/ThermopneumaticProcessingPlant.java index 6d076e639..51d002629 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/ThermopneumaticProcessingPlant.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/ThermopneumaticProcessingPlant.java @@ -54,7 +54,9 @@ public boolean removeByOutput(IIngredient output) { @MethodDescription(example = {@Example("item('minecraft:coal')"), @Example("fluid('diesel')")}) public boolean removeByInput(IIngredient input) { return BasicThermopneumaticProcessingPlantRecipe.recipes.removeIf(entry -> { - if (entry instanceof BasicThermopneumaticProcessingPlantRecipe recipe && (input.test(recipe.getInputLiquid()) || input.test(recipe.getInputItem()))) { + if ( + entry instanceof BasicThermopneumaticProcessingPlantRecipe recipe && (input.test(recipe.getInputLiquid()) || input.test(recipe.getInputItem())) + ) { addBackup(entry); return true; } @@ -96,7 +98,9 @@ public RecipeBuilder requiredTemperature(double requiredTemperature) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Thermopneumatic Processing Plant recipe"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Thermopneumatic Processing Plant recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/XpFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/XpFluid.java index 8c7ee05c3..42e0c547b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/XpFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/XpFluid.java @@ -88,7 +88,9 @@ public RecipeBuilder ratio(int ratio) { } @Override - public String getErrorMsg() { return "Error adding PneumaticCraft Liquid Fuel entry"; } + public String getErrorMsg() { + return "Error adding PneumaticCraft Liquid Fuel entry"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java index 06adb183f..555ce1cc4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java @@ -68,7 +68,9 @@ private boolean backupAndRemove(AtomicReshaperManager.AtomicReshaperRecipe recip } else { removed = AtomicReshaperManager.INSTANCE.removeRecipe(recipe.getInput()); } - if (removed == null) { return false; } + if (removed == null) { + return false; + } addBackup(removed); return true; } @@ -140,7 +142,9 @@ public AtomicReshaper.RecipeBuilder output(ItemStack output, int weight) { } @Override - public String getErrorMsg() { return "Error adding ProdigyTech Atomic Reshaper Recipe"; } + public String getErrorMsg() { + return "Error adding ProdigyTech Atomic Reshaper Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnace.java index f88e45534..0d91e1cfa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnace.java @@ -89,7 +89,9 @@ public ExplosionFurnace.RecipeBuilder power(int power) { } @Override - public String getErrorMsg() { return "Error adding ProdigyTech Explosion Furnace Recipe"; } + public String getErrorMsg() { + return "Error adding ProdigyTech Explosion Furnace Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java index 3e6076263..b12944197 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java @@ -49,7 +49,9 @@ public void validate(GroovyLog.Msg msg) { } @Override - public String getErrorMsg() { return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandler.this.name); } + public String getErrorMsg() { + return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandler.this.name); + } @Override @RecipeBuilderRegistrationMethod public @Nullable SimpleRecipe register() { @@ -77,7 +79,9 @@ public static class RotaryGrinder extends SimpleRecipeHandler { } @Override - protected int getDefaultTime() { return Config.rotaryGrinderProcessTime; } + protected int getDefaultTime() { + return Config.rotaryGrinderProcessTime; + } @Override @MethodDescription(example = @Example("item('minecraft:gravel')")) public boolean removeByInput(IIngredient input) { @@ -93,7 +97,9 @@ public static class MagneticReassembler extends SimpleRecipeHandler { } @Override - protected int getDefaultTime() { return Config.magneticReassemblerProcessTime; } + protected int getDefaultTime() { + return Config.magneticReassemblerProcessTime; + } @Override @MethodDescription(example = @Example("item('minecraft:gravel')")) public boolean removeByInput(IIngredient input) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerAbstract.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerAbstract.java index 5f82da4e8..889cd9087 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerAbstract.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerAbstract.java @@ -86,7 +86,9 @@ private boolean backupAndRemove(T recipe) { } else { removed = instance.removeRecipe(recipe.getInput()); } - if (removed == null) { return false; } + if (removed == null) { + return false; + } addBackup(removed); return true; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java index 7e0094e6a..48f46ff19 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java @@ -91,7 +91,9 @@ public static class HeatSawmill extends SimpleRecipeHandlerSecondaryOutput { } @Override - protected int getDefaultTime() { return Config.heatSawmillProcessTime; } + protected int getDefaultTime() { + return Config.heatSawmillProcessTime; + } @Override @MethodDescription(example = @Example("ore('plankWood')")) public boolean removeByInput(IIngredient input) { @@ -107,7 +109,9 @@ public static class OreRefinery extends SimpleRecipeHandlerSecondaryOutput { } @Override - protected int getDefaultTime() { return Config.oreRefineryProcessTime; } + protected int getDefaultTime() { + return Config.oreRefineryProcessTime; + } @Override @MethodDescription(example = @Example("ore('oreLapis')")) public boolean removeByInput(IIngredient input) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/Solderer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/Solderer.java index 4da3db806..3747dcaf2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/Solderer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/Solderer.java @@ -128,7 +128,9 @@ public Solderer.RecipeBuilder pattern(IIngredient pattern) { } @Override - public String getErrorMsg() { return "Error adding ProdigyTech Solderer Recipe"; } + public String getErrorMsg() { + return "Error adding ProdigyTech Solderer Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java index 5d5f42baa..0974d1227 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/Transmutation.java @@ -138,7 +138,9 @@ public RecipeBuilder output(Block output, Block altOutput) { } @Override - public String getErrorMsg() { return "Error adding ProjectE Transmutation recipe"; } + public String getErrorMsg() { + return "Error adding ProjectE Transmutation recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index 456b595db..998301585 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -51,9 +51,10 @@ public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hit @MethodDescription(example = @Example("item('minecraft:stone_slab', 3)")) public void removeByOutput(ItemStack output) { - if (GroovyLog.msg("Error removing pyrotech anvil recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing pyrotech anvil recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (AnvilRecipe recipe : getRegistry()) { @@ -122,7 +123,9 @@ public RecipeBuilder tierObsidian() { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Anvil Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Anvil Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index 5db462989..a6bf638df 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -37,8 +37,10 @@ public BarrelRecipe add(String name, IIngredient input1, IIngredient input2, IIn @MethodDescription(example = @Example("fluid('freckleberry_wine') * 1000")) public void removeByOutput(FluidStack output) { - if (GroovyLog.msg("Error removing barrel recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing barrel recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (BarrelRecipe recipe : getRegistry()) { @@ -64,7 +66,9 @@ public RecipeBuilder duration(int time) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Barrel Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Barrel Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index faedf1825..3fb9a99de 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -33,8 +33,10 @@ public CampfireRecipe add(String name, IIngredient input, ItemStack output, int @MethodDescription(example = @Example("item('minecraft:porkchop')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing campfire recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing campfire recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CampfireRecipe recipe : getRegistry()) { @@ -46,8 +48,10 @@ public void removeByInput(ItemStack input) { @MethodDescription(example = @Example("item('minecraft:cooked_porkchop')")) public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing campfire recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing campfire recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CampfireRecipe recipe : getRegistry()) { @@ -72,7 +76,9 @@ public RecipeBuilder duration(int time) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Campfire Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Campfire Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java index e9a925e92..c97cce5ed 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java @@ -31,9 +31,10 @@ public RecipeBuilder recipeBuilder() { @MethodDescription(example = @Example("item('minecraft:log2')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing chopping block recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing chopping block recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (ChoppingBlockRecipe recipe : getRegistry()) { @@ -45,9 +46,10 @@ public void removeByInput(ItemStack input) { @MethodDescription(example = @Example("item('minecraft:planks', 4)")) public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing chopping block recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing chopping block recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (ChoppingBlockRecipe recipe : getRegistry()) { @@ -75,7 +77,9 @@ public RecipeBuilder chops(int chops, int quantities) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Chopping Block Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Chopping Block Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index ae5cd42c7..af7cd5b79 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -34,9 +34,10 @@ public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, @MethodDescription(example = @Example("item('minecraft:snowball')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing compacting bin recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing compacting bin recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CompactingBinRecipe recipe : getRegistry()) { @@ -48,9 +49,10 @@ public void removeByInput(ItemStack input) { @MethodDescription(example = @Example("item('minecraft:bone_block')")) public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing compacting bin recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing compacting bin recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CompactingBinRecipe recipe : getRegistry()) { @@ -75,7 +77,9 @@ public RecipeBuilder toolUses(int toolUses) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Compacting Bin Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Compacting Bin Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index 33aa9e823..00e6ddc64 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -35,8 +35,10 @@ public CompostBinRecipe add(String name, IIngredient input, ItemStack output, in @MethodDescription(example = @Example("item('minecraft:golden_carrot')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing compost bin recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing compost bin recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CompostBinRecipe recipe : getRegistry()) { @@ -48,8 +50,10 @@ public void removeByInput(ItemStack input) { @MethodDescription public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing compost bin recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing compost bin recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (CompostBinRecipe recipe : getRegistry()) { @@ -74,7 +78,9 @@ public RecipeBuilder compostValue(int compostValue) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Compost Bin Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Compost Bin Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index 9569f8ab4..b1462d0e7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -34,9 +34,11 @@ public CrudeDryingRackRecipe add(String name, IIngredient input, ItemStack outpu @MethodDescription(example = @Example("item('minecraft:wheat')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing crude drying rack recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error removing crude drying rack recipe").add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty").error() - .postIfNotEmpty()) { + .postIfNotEmpty() + ) { return; } for (CrudeDryingRackRecipe recipe : getRegistry()) { @@ -48,9 +50,11 @@ public void removeByInput(ItemStack input) { @MethodDescription public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing crude drying rack recipe").add(IngredientHelper.isEmpty(output), + if ( + GroovyLog.msg("Error removing crude drying rack recipe").add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty").error() - .postIfNotEmpty()) { + .postIfNotEmpty() + ) { return; } for (CrudeDryingRackRecipe recipe : getRegistry()) { @@ -75,7 +79,9 @@ public RecipeBuilder dryTime(int time) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Crude Drying Rack Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Crude Drying Rack Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index b5f781a77..704cf88ed 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -34,8 +34,10 @@ public DryingRackRecipe add(String name, IIngredient input, ItemStack output, in @MethodDescription(example = @Example("item('minecraft:wheat')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing drying rack recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing drying rack recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (DryingRackRecipe recipe : getRegistry()) { @@ -47,8 +49,10 @@ public void removeByInput(ItemStack input) { @MethodDescription public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing drying rack recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing drying rack recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (DryingRackRecipe recipe : getRegistry()) { @@ -73,7 +77,9 @@ public RecipeBuilder dryTime(int time) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Drying Rack Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Drying Rack Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Kiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Kiln.java index 3803536eb..9509d004a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Kiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Kiln.java @@ -37,8 +37,10 @@ public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int b @MethodDescription public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing pit kiln recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing pit kiln recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (KilnPitRecipe recipe : getRegistry()) { @@ -50,8 +52,10 @@ public void removeByInput(ItemStack input) { @MethodDescription(example = @Example("item('pyrotech:bucket_clay')")) public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing pit kiln recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing pit kiln recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (KilnPitRecipe recipe : getRegistry()) { @@ -106,7 +110,9 @@ public RecipeBuilder failureOutput(Iterable failureOutputs) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Pit Kiln Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Pit Kiln Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index 3bed42d0a..09f2c3e4c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -34,8 +34,10 @@ public SoakingPotRecipe add(String name, IIngredient input, FluidStack fluidInpu @MethodDescription public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing soaking pot recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing soaking pot recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (SoakingPotRecipe recipe : getRegistry()) { @@ -47,8 +49,10 @@ public void removeByInput(ItemStack input) { @MethodDescription(example = @Example("item('pyrotech:material', 54)")) public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing soaking pot recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing soaking pot recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (SoakingPotRecipe recipe : getRegistry()) { @@ -83,7 +87,9 @@ public RecipeBuilder campfireRequired(boolean campfireRequired) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Soaking Pot Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Soaking Pot Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index 194cfffd5..b3a8638b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -34,8 +34,10 @@ public TanningRackRecipe add(String name, IIngredient input, ItemStack output, i @MethodDescription(example = @Example("item('minecraft:wheat')")) public void removeByInput(ItemStack input) { - if (GroovyLog.msg("Error removing tanning rack recipe").add(IngredientHelper.isEmpty(input), - () -> "Input 1 must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing tanning rack recipe").add(IngredientHelper.isEmpty(input), + () -> "Input 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (TanningRackRecipe recipe : getRegistry()) { @@ -47,9 +49,10 @@ public void removeByInput(ItemStack input) { @MethodDescription public void removeByOutput(IIngredient output) { - if (GroovyLog.msg("Error removing tanning rack recipe").add(IngredientHelper.isEmpty(output), - () -> "Output 1 must not be empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing tanning rack recipe").add(IngredientHelper.isEmpty(output), + () -> "Output 1 must not be empty").error().postIfNotEmpty() + ) { return; } for (TanningRackRecipe recipe : getRegistry()) { @@ -82,7 +85,9 @@ public RecipeBuilder dryTime(int time) { } @Override - public String getErrorMsg() { return "Error adding Pyrotech Tanning Rack Recipe"; } + public String getErrorMsg() { + return "Error adding Pyrotech Tanning Rack Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvest.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvest.java index 03037bebd..7046ff945 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvest.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvest.java @@ -95,10 +95,14 @@ public RecipeBuilder entity(EntityEntry entity) { } @Override - public String getErrorMsg() { return "Error adding Roots Animal Harvest recipe"; } + public String getErrorMsg() { + return "Error adding Roots Animal Harvest recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_animal_harvest_"; } + public String getRecipeNamePrefix() { + return "groovyscript_animal_harvest_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvestFish.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvestFish.java index f31c19e3f..105118e22 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvestFish.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/AnimalHarvestFish.java @@ -105,10 +105,14 @@ public RecipeBuilder fish(ItemStack fish) { } @Override - public String getErrorMsg() { return "Error adding Roots Animal Harvest Fish recipe"; } + public String getErrorMsg() { + return "Error adding Roots Animal Harvest Fish recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_animal_harvest_fish_"; } + public String getRecipeNamePrefix() { + return "groovyscript_animal_harvest_fish_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/BarkCarving.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/BarkCarving.java index 611f0fd14..e8a0e74cf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/BarkCarving.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/BarkCarving.java @@ -142,10 +142,14 @@ public RecipeBuilder input(IBlockState blockstate) { } @Override - public String getErrorMsg() { return "Error adding Roots Bark Carving recipe"; } + public String getErrorMsg() { + return "Error adding Roots Bark Carving recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_bark_carving_"; } + public String getRecipeNamePrefix() { + return "groovyscript_bark_carving_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Chrysopoeia.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Chrysopoeia.java index 45865cc7d..753d812bc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Chrysopoeia.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Chrysopoeia.java @@ -128,10 +128,14 @@ public static class RecipeBuilder extends AbstractRecipeBuilder allowedSoilss) { } @Override - public String getErrorMsg() { return "Error adding Roots Flower Generation recipe"; } + public String getErrorMsg() { + return "Error adding Roots Flower Generation recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_flower_generation_recipe_"; } + public String getRecipeNamePrefix() { + return "groovyscript_flower_generation_recipe_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java index 706a637ca..ef8f2af0a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java @@ -239,10 +239,14 @@ public RecipeBuilder generate() { } @Override - public String getErrorMsg() { return "Error adding Roots Mortar recipe"; } + public String getErrorMsg() { + return "Error adding Roots Mortar recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_mortar_recipe_"; } + public String getRecipeNamePrefix() { + return "groovyscript_mortar_recipe_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Moss.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Moss.java index c8800407c..aab2b07d4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Moss.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Moss.java @@ -108,7 +108,9 @@ public SimpleObjectStream> streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder> { @Override - public String getErrorMsg() { return "Error adding Roots Moss conversion"; } + public String getErrorMsg() { + return "Error adding Roots Moss conversion"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pacifist.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pacifist.java index ec226b975..f39df918e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pacifist.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pacifist.java @@ -99,10 +99,14 @@ public RecipeBuilder entity(EntityEntry entity) { } @Override - public String getErrorMsg() { return "Error adding Roots Runic Shear Entity recipe"; } + public String getErrorMsg() { + return "Error adding Roots Runic Shear Entity recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_pacifist_"; } + public String getRecipeNamePrefix() { + return "groovyscript_pacifist_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Predicates.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Predicates.java index 4931e8565..2e73469a0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Predicates.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Predicates.java @@ -107,7 +107,9 @@ public StateBuilder below() { } @Override - public String getErrorMsg() { return "Error creating Roots Predicate"; } + public String getErrorMsg() { + return "Error creating Roots Predicate"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java index 4e4297db2..19c207ad4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java @@ -122,10 +122,14 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Roots Pyre recipe"; } + public String getErrorMsg() { + return "Error adding Roots Pyre recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_pyre_recipe_"; } + public String getRecipeNamePrefix() { + return "groovyscript_pyre_recipe_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java index 399204313..accffb626 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java @@ -136,7 +136,9 @@ public RecipeBuilder ritual(RitualBase ritual) { } @Override - public String getErrorMsg() { return "Error creating Roots Ritual Recipe"; } + public String getErrorMsg() { + return "Error creating Roots Ritual Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearBlock.java index 1863fb403..2c3f2cfe1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearBlock.java @@ -131,10 +131,14 @@ public RecipeBuilder replacementState(IBlockState replacementState) { } @Override - public String getErrorMsg() { return "Error adding Roots Runic Shear Block recipe"; } + public String getErrorMsg() { + return "Error adding Roots Runic Shear Block recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_runic_shear_block_"; } + public String getRecipeNamePrefix() { + return "groovyscript_runic_shear_block_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearEntity.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearEntity.java index fbc0265ab..5dac0a000 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearEntity.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/RunicShearEntity.java @@ -133,10 +133,14 @@ public RecipeBuilder functionMap(Function functionM } @Override - public String getErrorMsg() { return "Error adding Roots Runic Shear Entity recipe"; } + public String getErrorMsg() { + return "Error adding Roots Runic Shear Entity recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_runic_shear_entity_"; } + public String getRecipeNamePrefix() { + return "groovyscript_runic_shear_entity_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Spells.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Spells.java index aff937745..421857393 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Spells.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Spells.java @@ -243,7 +243,9 @@ public RecipeBuilder spell(SpellBase spell) { } @Override - public String getErrorMsg() { return "Error creating Roots Spell Recipe"; } + public String getErrorMsg() { + return "Error creating Roots Spell Recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -294,7 +296,9 @@ public CostBuilder cost(CostType cost) { } @Override - public String getErrorMsg() { return "Error creating Roots Spell Cost"; } + public String getErrorMsg() { + return "Error creating Roots Spell Cost"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/SummonCreature.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/SummonCreature.java index 398ff8275..c7c981f51 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/SummonCreature.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/SummonCreature.java @@ -106,10 +106,14 @@ public RecipeBuilder entity(EntityEntry entity) { } @Override - public String getErrorMsg() { return "Error adding Roots Summon Creature recipe"; } + public String getErrorMsg() { + return "Error adding Roots Summon Creature recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_summon_creature_"; } + public String getRecipeNamePrefix() { + return "groovyscript_summon_creature_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Transmutation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Transmutation.java index 6c5e99086..00768a397 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Transmutation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Transmutation.java @@ -99,10 +99,12 @@ public boolean removeByOutput(IBlockState output) { Collection> incoming = output.getPropertyKeys(); Collection> current = state.get().getPropertyKeys(); - if (state.get().getBlock() == output.getBlock() && output.getPropertyKeys().stream().allMatch(prop -> incoming + if ( + state.get().getBlock() == output.getBlock() && output.getPropertyKeys().stream().allMatch(prop -> incoming .contains(prop) && current.contains(prop) && state.get() .getValue(prop) - .equals(output.getValue(prop)))) { + .equals(output.getValue(prop))) + ) { addBackup(x.getValue()); return true; } @@ -164,10 +166,14 @@ public RecipeBuilder condition(WorldBlockStatePredicate condition) { } @Override - public String getErrorMsg() { return "Error adding Roots Transmutation recipe"; } + public String getErrorMsg() { + return "Error adding Roots Transmutation recipe"; + } @Override - public String getRecipeNamePrefix() { return "groovyscript_transmutation_"; } + public String getRecipeNamePrefix() { + return "groovyscript_transmutation_"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java index 51b32c978..572fd9d91 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java @@ -144,7 +144,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Rustic Alchemy recipe"; } + public String getErrorMsg() { + return "Error adding Rustic Alchemy recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/BrewingBarrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/BrewingBarrel.java index 61299d799..1db1b845e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/BrewingBarrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/BrewingBarrel.java @@ -76,7 +76,9 @@ public SimpleObjectStream streamRecipes() { public static class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Rustic Brewing Barrel recipe"; } + public String getErrorMsg() { + return "Error adding Rustic Brewing Barrel recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CondenserRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CondenserRecipe.java index ccdca0cdb..16f29607f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CondenserRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CondenserRecipe.java @@ -65,7 +65,9 @@ public CondenserRecipe(@Nonnull ItemStack output, List inputs, IIng @Override public boolean matches(Fluid fluid, ItemStack modifier, ItemStack bottle, ItemStack[] inputs) { - if (fluid == this.fluid.getFluid() && (this.modifier == null || this.modifier.test(modifier)) && (this.modifier != null || modifier.isEmpty()) && (this.bottle == null || this.bottle.test(bottle))) { + if ( + fluid == this.fluid.getFluid() && (this.modifier == null || this.modifier.test(modifier)) && (this.modifier != null || modifier.isEmpty()) && (this.bottle == null || this.bottle.test(bottle)) + ) { List tempInputs = new ArrayList<>(this.inputs); for (ItemStack stack : inputs) { if (stack != null && !stack.isEmpty()) { @@ -81,7 +83,9 @@ public boolean matches(Fluid fluid, ItemStack modifier, ItemStack bottle, ItemSt } } - if (stackNotInput) { return false; } + if (stackNotInput) { + return false; + } } } return tempInputs.isEmpty(); @@ -90,19 +94,29 @@ public boolean matches(Fluid fluid, ItemStack modifier, ItemStack bottle, ItemSt } @Override - public boolean isBasic() { return !this.advanced; } + public boolean isBasic() { + return !this.advanced; + } @Override - public boolean isAdvanced() { return this.advanced; } + public boolean isAdvanced() { + return this.advanced; + } @Override - public FluidStack getFluid() { return this.fluid; } + public FluidStack getFluid() { + return this.fluid; + } @Override - public List getModifiers() { return modifier == null ? EMPTY_LIST : Arrays.asList(modifier.getMatchingStacks()); } + public List getModifiers() { + return modifier == null ? EMPTY_LIST : Arrays.asList(modifier.getMatchingStacks()); + } @Override - public List getBottles() { return bottle == null ? EMPTY_LIST : Arrays.asList(bottle.getMatchingStacks()); } + public List getBottles() { + return bottle == null ? EMPTY_LIST : Arrays.asList(bottle.getMatchingStacks()); + } @Override public List> getInputs() { @@ -110,7 +124,9 @@ public List> getInputs() { } @Override - public int getTime() { return this.time; } + public int getTime() { + return this.time; + } @Override public int getModifierConsumption(ItemStack modifier) { @@ -140,5 +156,7 @@ public int[] getInputConsumption(ItemStack[] inputs) { } @Override - public ItemStack getResult() { return this.output.copy(); } + public ItemStack getResult() { + return this.output.copy(); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java index 3baaf4698..c2c0c467f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java @@ -87,7 +87,9 @@ public RecipeBuilder byproduct(ItemStack byproduct) { } @Override - public String getErrorMsg() { return "Error adding Rustic Crushing Tub recipe"; } + public String getErrorMsg() { + return "Error adding Rustic Crushing Tub recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/EvaporatingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/EvaporatingBasin.java index dc5886f35..ba404f6e3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/EvaporatingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/EvaporatingBasin.java @@ -95,7 +95,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Rustic Evaporating Basin recipe"; } + public String getErrorMsg() { + return "Error adding Rustic Evaporating Basin recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/ExtendedEvaporatingBasinRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/ExtendedEvaporatingBasinRecipe.java index 088d052ce..dc3d055ae 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/ExtendedEvaporatingBasinRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/ExtendedEvaporatingBasinRecipe.java @@ -15,6 +15,8 @@ public ExtendedEvaporatingBasinRecipe(ItemStack out, FluidStack in, int time) { } @Override - public int getTime() { return time; } + public int getTime() { + return time; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/HighOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/HighOven.java index d428a0825..6720dda49 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/HighOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/HighOven.java @@ -261,7 +261,9 @@ public RecipeBuilder purifier(IIngredient ingredient) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Complement High Oven Mixing recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Complement High Oven Mixing recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -377,7 +379,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Complement High Oven Heating recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Complement High Oven Heating recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -462,7 +466,9 @@ public RecipeBuilder rate(int rate) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Complement High Oven fuel"; } + public String getErrorMsg() { + return "Error adding Tinkers Complement High Oven fuel"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java index e91a87a66..30f7273ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java @@ -71,7 +71,9 @@ public boolean remove(CrucibleRecipe recipe) { Object r; do { - if (!recipeIterator.hasNext()) { return false; } + if (!recipeIterator.hasNext()) { + return false; + } r = recipeIterator.next(); } while (!(r instanceof CrucibleRecipe) || !((CrucibleRecipe) r).getRecipeOutput().isItemEqual(recipe.getRecipeOutput())); @@ -159,7 +161,9 @@ public RecipeBuilder catalyst(IIngredient catalyst) { } @Override - public String getErrorMsg() { return "Error adding Thaumcraft Crucible recipe"; } + public String getErrorMsg() { + return "Error adding Thaumcraft Crucible recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/DustTrigger.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/DustTrigger.java index 2b04816d6..189857f8a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/DustTrigger.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/DustTrigger.java @@ -43,7 +43,9 @@ private void doDirtyReflection() { oreTriggerResult.setAccessible(true); didReflection = true; - } catch (NoSuchFieldException e) { + } catch ( + NoSuchFieldException e + ) { e.printStackTrace(); } } @@ -60,16 +62,19 @@ public boolean remove(IDustTrigger trigger) { boolean found = false; while (it.hasNext()) { final IDustTrigger registeredTrigger = it.next(); - if (trigger instanceof DustTriggerSimple && registeredTrigger instanceof DustTriggerSimple && trigger.equals(registeredTrigger)) { + if ( + trigger instanceof DustTriggerSimple && registeredTrigger instanceof DustTriggerSimple && trigger.equals(registeredTrigger) + ) { it.remove(); addBackup(trigger); found = true; - } else if (trigger instanceof DustTriggerOre && registeredTrigger instanceof DustTriggerOre && trigger.equals( - registeredTrigger)) { - it.remove(); - addBackup(trigger); - found = true; - } + } else if ( + trigger instanceof DustTriggerOre && registeredTrigger instanceof DustTriggerOre && trigger.equals(registeredTrigger) + ) { + it.remove(); + addBackup(trigger); + found = true; + } } return found; } @@ -81,15 +86,20 @@ public void removeByOutput(ItemStack output) { while (it.hasNext()) { final IDustTrigger trigger = it.next(); try { - if (trigger instanceof DustTriggerSimple && simpleTriggerResult != null && output.isItemEqual((ItemStack) simpleTriggerResult.get(trigger))) { + if ( + trigger instanceof DustTriggerSimple && simpleTriggerResult != null && output.isItemEqual((ItemStack) simpleTriggerResult.get(trigger)) + ) { + it.remove(); + addBackup(trigger); + } else if ( + trigger instanceof DustTriggerOre && oreTriggerResult != null && output.isItemEqual((ItemStack) oreTriggerResult.get(trigger)) + ) { it.remove(); addBackup(trigger); - } else if (trigger instanceof DustTriggerOre && oreTriggerResult != null && output.isItemEqual( - (ItemStack) oreTriggerResult.get(trigger))) { - it.remove(); - addBackup(trigger); - } - } catch (IllegalAccessException e) { + } + } catch ( + IllegalAccessException e + ) { GroovyLog.msg("Error while applying Salis Mundus effect: " + e).error().post(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java index f238a6476..61210a8f2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java @@ -176,7 +176,9 @@ public RecipeBuilder instability(int instability) { } @Override - public String getErrorMsg() { return "Error adding Thaumcraft Infusion Crafting recipe"; } + public String getErrorMsg() { + return "Error adding Thaumcraft Infusion Crafting recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/LootBag.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/LootBag.java index de11fb752..11bf0e0c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/LootBag.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/LootBag.java @@ -31,11 +31,17 @@ public void onReload() { restoreFromBackup().forEach(bag -> ThaumcraftApi.addLootBagItem(bag.getItem(), bag.getWeight(), bag.getRarity())); } - public static LootBagHelper getCommon() { return new LootBagHelper(0); } + public static LootBagHelper getCommon() { + return new LootBagHelper(0); + } - public static LootBagHelper getUncommon() { return new LootBagHelper(1); } + public static LootBagHelper getUncommon() { + return new LootBagHelper(1); + } - public static LootBagHelper getRare() { return new LootBagHelper(2); } + public static LootBagHelper getRare() { + return new LootBagHelper(2); + } private static ArrayList getLootbag(int rarity) { return switch (rarity) { @@ -115,11 +121,17 @@ private InternalLootbag(ItemStack item, int weight, int rarity) { this.rarity = rarity; } - public ItemStack getItem() { return item; } + public ItemStack getItem() { + return item; + } - public int getWeight() { return weight; } + public int getWeight() { + return weight; + } - public int getRarity() { return rarity; } + public int getRarity() { + return rarity; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneRecipeBuilder.java index 56322d2da..e0a99f802 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneRecipeBuilder.java @@ -72,7 +72,9 @@ public ArcaneRecipeBuilder vis(int vis) { } @Override - public String getRecipeNamePrefix() { return "groovyscript_shaped_arcane_"; } + public String getRecipeNamePrefix() { + return "groovyscript_shaped_arcane_"; + } @Override @RecipeBuilderRegistrationMethod public IRecipe register() { @@ -154,7 +156,9 @@ public ArcaneRecipeBuilder vis(int vis) { } @Override - public String getRecipeNamePrefix() { return "groovyscript_shapeless_arcane_"; } + public String getRecipeNamePrefix() { + return "groovyscript_shapeless_arcane_"; + } @Override @RecipeBuilderRegistrationMethod public IRecipe register() { @@ -169,7 +173,9 @@ public IRecipe register() { " but found " + ingredients.size()) .error(); - if (msg.postIfNotEmpty()) { return null; } + if (msg.postIfNotEmpty()) { + return null; + } handleReplace(); ShapelessArcaneCR recipe = new ShapelessArcaneCR(output.copy(), ingredients, recipeFunction, recipeAction, researchKey, vis, aspects); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapedArcaneCR.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapedArcaneCR.java index 38a956586..fb9c21f5b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapedArcaneCR.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapedArcaneCR.java @@ -42,16 +42,24 @@ public ShapedArcaneCR(ItemStack output, List input, int width, int } @Override - public int getRecipeWidth() { return craftingRecipe.getRecipeWidth(); } + public int getRecipeWidth() { + return craftingRecipe.getRecipeWidth(); + } @Override @SuppressWarnings("deprecation") - public int getWidth() { return craftingRecipe.getRecipeWidth(); } + public int getWidth() { + return craftingRecipe.getRecipeWidth(); + } @Override - public int getRecipeHeight() { return craftingRecipe.getRecipeHeight(); } + public int getRecipeHeight() { + return craftingRecipe.getRecipeHeight(); + } @Override @SuppressWarnings("deprecation") - public int getHeight() { return craftingRecipe.getRecipeHeight(); } + public int getHeight() { + return craftingRecipe.getRecipeHeight(); + } @Override public boolean canFit(int width, int height) { @@ -59,7 +67,9 @@ public boolean canFit(int width, int height) { } @Override - public boolean isDynamic() { return craftingRecipe.isDynamic(); } + public boolean isDynamic() { + return craftingRecipe.isDynamic(); + } @Override public @NotNull ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { @@ -67,16 +77,24 @@ public boolean canFit(int width, int height) { } @Override - public @NotNull ItemStack getRecipeOutput() { return craftingRecipe.getRecipeOutput(); } + public @NotNull ItemStack getRecipeOutput() { + return craftingRecipe.getRecipeOutput(); + } @Override @Nullable - public Closure getRecipeAction() { return craftingRecipe.getRecipeAction(); } + public Closure getRecipeAction() { + return craftingRecipe.getRecipeAction(); + } @Override @Nullable - public Closure getRecipeFunction() { return craftingRecipe.getRecipeFunction(); } + public Closure getRecipeFunction() { + return craftingRecipe.getRecipeFunction(); + } @Override - public @NotNull NonNullList getIngredients() { return craftingRecipe.getIngredients(); } + public @NotNull NonNullList getIngredients() { + return craftingRecipe.getIngredients(); + } @Override public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { @@ -85,7 +103,9 @@ public boolean canFit(int width, int height) { @Override public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { - if (!(inv instanceof IArcaneWorkbench) || inv.getSizeInventory() < 15) { return false; } + if (!(inv instanceof IArcaneWorkbench) || inv.getSizeInventory() < 15) { + return false; + } InventoryCrafting dummy = new InventoryCrafting(new ContainerDummy(), 3, 3); for (int a = 0; a < 9; ++a) { @@ -103,13 +123,17 @@ public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { for (int i = 0; i < 6; ++i) { ItemStack itemstack1 = inv.getStackInSlot(9 + i); - if (itemstack1 != null && itemstack1.getItem() == ItemsTC.crystalEssence && itemstack1.getCount() >= cs.getCount() && ItemStack.areItemStackTagsEqual(cs, - itemstack1)) { + if ( + itemstack1 != null && itemstack1.getItem() == ItemsTC.crystalEssence && itemstack1.getCount() >= cs.getCount() && ItemStack.areItemStackTagsEqual(cs, + itemstack1) + ) { b = true; } } - if (!b) { return false; } + if (!b) { + return false; + } } } return craftingRecipe.matches(dummy, worldIn); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapelessArcaneCR.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapelessArcaneCR.java index 0120f4a4d..09166d40f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapelessArcaneCR.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ShapelessArcaneCR.java @@ -44,7 +44,9 @@ public boolean canFit(int width, int height) { } @Override - public boolean isDynamic() { return craftingRecipe.isDynamic(); } + public boolean isDynamic() { + return craftingRecipe.isDynamic(); + } @Override public @NotNull ItemStack getCraftingResult(@NotNull InventoryCrafting inv) { @@ -52,16 +54,24 @@ public boolean canFit(int width, int height) { } @Override - public @NotNull ItemStack getRecipeOutput() { return craftingRecipe.getRecipeOutput(); } + public @NotNull ItemStack getRecipeOutput() { + return craftingRecipe.getRecipeOutput(); + } @Override @Nullable - public Closure getRecipeAction() { return craftingRecipe.getRecipeAction(); } + public Closure getRecipeAction() { + return craftingRecipe.getRecipeAction(); + } @Override @Nullable - public Closure getRecipeFunction() { return craftingRecipe.getRecipeFunction(); } + public Closure getRecipeFunction() { + return craftingRecipe.getRecipeFunction(); + } @Override - public @NotNull NonNullList getIngredients() { return craftingRecipe.getIngredients(); } + public @NotNull NonNullList getIngredients() { + return craftingRecipe.getIngredients(); + } @Override public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { @@ -92,13 +102,17 @@ public boolean matches(@NotNull InventoryCrafting inv, @NotNull World world) { for (int i = 0; i < 6; ++i) { ItemStack itemstack1 = inv.getStackInSlot(9 + i); - if (itemstack1 != null && itemstack1.getItem() == ItemsTC.crystalEssence && itemstack1.getCount() >= cs.getCount() && ItemStack.areItemStackTagsEqual(cs, - itemstack1)) { + if ( + itemstack1 != null && itemstack1.getItem() == ItemsTC.crystalEssence && itemstack1.getCount() >= cs.getCount() && ItemStack.areItemStackTagsEqual(cs, + itemstack1) + ) { b = true; } } - if (!b) { return false; } + if (!b) { + return false; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java index ff6f1f587..5190384e1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java @@ -123,7 +123,9 @@ public thaumcraft.api.aspects.Aspect register() { image, blend); ModSupport.THAUMCRAFT.get().aspect.add(aspect); return aspect; - } catch (IllegalArgumentException e) { + } catch ( + IllegalArgumentException e + ) { GroovyLog.msg("Error adding Thaumcraft Aspect: ").add(e.getMessage()).error().post(); } return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectHelper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectHelper.java index fcfd870f2..fd330c503 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectHelper.java @@ -45,15 +45,18 @@ else if (aspectList.entity != null) for (AspectStack as : aspectList.aspects) th public void addScripted(Object target, AspectStack aspect) { AtomicBoolean found = new AtomicBoolean(false); getScriptedRecipes().forEach(scriptedAspect -> { - if (target instanceof EntityEntry && scriptedAspect.entity != null && ((EntityEntry) target).getName().equals( - scriptedAspect.entity.getName())) { + if ( + target instanceof EntityEntry && scriptedAspect.entity != null && ((EntityEntry) target).getName().equals( + scriptedAspect.entity.getName()) + ) { found.set(true); scriptedAspect.addAspect(aspect); - } else if (target instanceof ItemStack && scriptedAspect.item != null && ((ItemStack) target).isItemEqual( - scriptedAspect.item)) { - found.set(true); - scriptedAspect.addAspect(aspect); - } + } else if ( + target instanceof ItemStack && scriptedAspect.item != null && ((ItemStack) target).isItemEqual(scriptedAspect.item) + ) { + found.set(true); + scriptedAspect.addAspect(aspect); + } }); if (!found.get()) { @@ -68,15 +71,18 @@ public void addScripted(Object target, AspectStack aspect) { public void addBackup(Object target, AspectStack aspect) { AtomicBoolean found = new AtomicBoolean(false); getBackupRecipes().forEach(backupAspect -> { - if (target instanceof EntityEntry && backupAspect.entity != null && ((EntityEntry) target).getName().equals( - backupAspect.entity.getName())) { + if ( + target instanceof EntityEntry && backupAspect.entity != null && ((EntityEntry) target).getName().equals( + backupAspect.entity.getName()) + ) { found.set(true); backupAspect.addAspect(aspect); - } else if (target instanceof ItemStack && backupAspect.item != null && ((ItemStack) target).isItemEqual( - backupAspect.item)) { - found.set(true); - backupAspect.addAspect(aspect); - } + } else if ( + target instanceof ItemStack && backupAspect.item != null && ((ItemStack) target).isItemEqual(backupAspect.item) + ) { + found.set(true); + backupAspect.addAspect(aspect); + } }); if (!found.get()) { @@ -151,7 +157,9 @@ public void add(OreDictIngredient oreDic, AspectStack aspect, boolean doBackup) ItemStack oc = ore.copy(); oc.setCount(1); this.add(oc, aspect, doBackup); - } catch (Exception ignored) {} + } catch ( + Exception ignored + ) {} } } return; @@ -204,7 +212,9 @@ public void remove(OreDictIngredient oreDic, AspectStack aspect, boolean doBacku ItemStack oc = ore.copy(); oc.setCount(1); this.remove(oc, aspect, doBackup); - } catch (Exception ignored) {} + } catch ( + Exception ignored + ) {} } } return; @@ -252,7 +262,9 @@ public void removeAll(OreDictIngredient oreDic) { ItemStack oc = ore.copy(); oc.setCount(1); this.removeAll(oc); - } catch (Exception ignored) {} + } catch ( + Exception ignored + ) {} } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectStack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectStack.java index b265bf8b0..42e892530 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectStack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectStack.java @@ -36,22 +36,34 @@ public AspectStack(Aspect aspect, int amount) { this.amount = amount; } - public Aspect getAspect() { return this.aspect; } + public Aspect getAspect() { + return this.aspect; + } - public void setAspect(Aspect aspect) { this.aspect = aspect; } + public void setAspect(Aspect aspect) { + this.aspect = aspect; + } @Override - public int getAmount() { return amount; } + public int getAmount() { + return amount; + } @Override - public void setAmount(int amount) { this.amount = amount; } + public void setAmount(int amount) { + this.amount = amount; + } @Override public AspectStack exactCopy() { return new AspectStack(this.aspect, this.amount); } - public ItemStack getCrystal() { return ThaumcraftApiHelper.makeCrystal(this.aspect, this.amount); } + public ItemStack getCrystal() { + return ThaumcraftApiHelper.makeCrystal(this.aspect, this.amount); + } - public ItemStack getPhial() { return ItemPhial.makeFilledPhial(this.aspect); } + public ItemStack getPhial() { + return ItemPhial.makeFilledPhial(this.aspect); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/Warp.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/Warp.java index 8d9709522..ffcab0ec1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/Warp.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/Warp.java @@ -54,9 +54,13 @@ private InternalWarp(Object key, int warp) { this.warp = warp; } - public Object getKey() { return key; } + public Object getKey() { + return key; + } - public int getWarp() { return warp; } + public int getWarp() { + return warp; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Coolant.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Coolant.java index 96f9661db..cd8e976f8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Coolant.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Coolant.java @@ -58,8 +58,10 @@ public void add(FluidStack fluid, int rf, int factor) { } public boolean remove(String fluid) { - if (CoolantManagerAccessor.getCoolantMap().containsKey(fluid) && CoolantManagerAccessor.getCoolantFactorMap().containsKey( - fluid)) { + if ( + CoolantManagerAccessor.getCoolantMap().containsKey(fluid) && CoolantManagerAccessor.getCoolantFactorMap().containsKey( + fluid) + ) { addBackup(new CoolantRecipe(fluid, CoolantManagerAccessor.getCoolantMap().removeInt(fluid), CoolantManagerAccessor .getCoolantFactorMap() .removeInt(fluid))); @@ -69,8 +71,10 @@ public boolean remove(String fluid) { } public boolean remove(CoolantRecipe recipe) { - if (CoolantManagerAccessor.getCoolantMap().containsKey(recipe.fluid()) && CoolantManagerAccessor.getCoolantFactorMap() - .containsKey(recipe.fluid())) { + if ( + CoolantManagerAccessor.getCoolantMap().containsKey(recipe.fluid()) && CoolantManagerAccessor.getCoolantFactorMap() + .containsKey(recipe.fluid()) + ) { addBackup(new CoolantRecipe(recipe.fluid(), CoolantManagerAccessor.getCoolantMap().removeInt(recipe.fluid()), CoolantManagerAccessor.getCoolantFactorMap().removeInt(recipe.fluid()))); return true; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Diffuser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Diffuser.java index c0670fba3..6feadeb05 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Diffuser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Diffuser.java @@ -45,8 +45,10 @@ public void add(ItemStack stack, int amplifier, int duration) { } public boolean remove(ComparableItemStack stack) { - if (DiffuserManagerAccessor.getReagentAmpMap().containsKey(stack) && DiffuserManagerAccessor.getReagentDurMap() - .containsKey(stack)) { + if ( + DiffuserManagerAccessor.getReagentAmpMap().containsKey(stack) && DiffuserManagerAccessor.getReagentDurMap() + .containsKey(stack) + ) { addBackup(new DiffuserRecipe(stack)); DiffuserManagerAccessor.getReagentAmpMap().remove(stack); DiffuserManagerAccessor.getReagentDurMap().remove(stack); @@ -56,8 +58,10 @@ public boolean remove(ComparableItemStack stack) { } public boolean remove(DiffuserRecipe recipe) { - if (DiffuserManagerAccessor.getReagentAmpMap().containsKey(recipe.stack()) && DiffuserManagerAccessor.getReagentDurMap() - .containsKey(recipe.stack())) { + if ( + DiffuserManagerAccessor.getReagentAmpMap().containsKey(recipe.stack()) && DiffuserManagerAccessor.getReagentDurMap() + .containsKey(recipe.stack()) + ) { addBackup(new DiffuserRecipe(recipe.stack())); DiffuserManagerAccessor.getReagentAmpMap().remove(recipe.stack()); DiffuserManagerAccessor.getReagentDurMap().remove(recipe.stack()); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Factorizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Factorizer.java index 3f22ffbf6..ba7c62fd9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Factorizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Factorizer.java @@ -166,7 +166,9 @@ public RecipeBuilder split() { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Factorizer recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Factorizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/XpCollector.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/XpCollector.java index 4bbde6dcb..fb43bfee8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/XpCollector.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/XpCollector.java @@ -42,9 +42,11 @@ public void add(ItemStack catalyst, int xp, int factor) { } public boolean remove(ComparableItemStack comparableItemStack) { - if (XpCollectorManagerAccessor.getCatalystMap().containsKey(comparableItemStack) && XpCollectorManagerAccessor + if ( + XpCollectorManagerAccessor.getCatalystMap().containsKey(comparableItemStack) && XpCollectorManagerAccessor .getCatalystFactorMap() - .containsKey(comparableItemStack)) { + .containsKey(comparableItemStack) + ) { addBackup(new XpCollectorRecipe(new ItemStack(comparableItemStack.item, comparableItemStack.metadata), XpCollectorManagerAccessor.getCatalystMap().remove(comparableItemStack), XpCollectorManagerAccessor.getCatalystFactorMap().remove(comparableItemStack))); @@ -56,8 +58,10 @@ public boolean remove(ComparableItemStack comparableItemStack) { @MethodDescription(example = @Example("item('minecraft:soul_sand')")) public boolean remove(ItemStack itemStack) { ComparableItemStack help = new ComparableItemStack(itemStack); - if (XpCollectorManagerAccessor.getCatalystMap().containsKey(help) && XpCollectorManagerAccessor.getCatalystFactorMap() - .containsKey(help)) { + if ( + XpCollectorManagerAccessor.getCatalystMap().containsKey(help) && XpCollectorManagerAccessor.getCatalystFactorMap() + .containsKey(help) + ) { addBackup(new XpCollectorRecipe(itemStack, XpCollectorManagerAccessor.getCatalystMap().remove(help), XpCollectorManagerAccessor.getCatalystFactorMap().remove(help))); return true; @@ -66,9 +70,11 @@ public boolean remove(ItemStack itemStack) { } public boolean remove(XpCollectorRecipe recipe) { - if (XpCollectorManagerAccessor.getCatalystMap().containsKey(recipe.getComparableStack()) && XpCollectorManagerAccessor + if ( + XpCollectorManagerAccessor.getCatalystMap().containsKey(recipe.getComparableStack()) && XpCollectorManagerAccessor .getCatalystFactorMap() - .containsKey(recipe.getComparableStack())) { + .containsKey(recipe.getComparableStack()) + ) { addBackup(new XpCollectorRecipe(recipe.catalyst(), XpCollectorManagerAccessor.getCatalystMap().remove(recipe .getComparableStack()), XpCollectorManagerAccessor.getCatalystFactorMap().remove(recipe @@ -99,7 +105,9 @@ public void removeAll() { @Desugar public record XpCollectorRecipe(ItemStack catalyst, int xp, int factor) { - public ComparableItemStack getComparableStack() { return new ComparableItemStack(catalyst()); } + public ComparableItemStack getComparableStack() { + return new ComparableItemStack(catalyst()); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Reactant.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Reactant.java index fcca18d7e..2631597e5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Reactant.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Reactant.java @@ -130,9 +130,11 @@ public boolean remove(ReactantManager.Reaction recipe) { @MethodDescription(example = {@Example("item('minecraft:blaze_powder')"), @Example("fluid('redstone')")}) public boolean removeByInput(IIngredient input) { return ReactantManagerAccessor.getReactionMap().values().removeIf(r -> { - if (input.test(r.getReactant()) || (input instanceof FluidStack && IngredientHelper.toFluidStack(input).getFluid() + if ( + input.test(r.getReactant()) || (input instanceof FluidStack && IngredientHelper.toFluidStack(input).getFluid() .getName().equals(r - .getFluidName()))) { + .getFluidName())) + ) { addBackup(r); return true; } @@ -164,7 +166,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Reactant Dynamo recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Reactant Dynamo recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Brewer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Brewer.java index 6d11ea8aa..a286b7e11 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Brewer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Brewer.java @@ -141,7 +141,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Brewer recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Brewer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Centrifuge.java index 723818b1a..a4912cbfd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Centrifuge.java @@ -135,7 +135,9 @@ public RecipeBuilder chance(List chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Centrifuge recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Centrifuge recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/CentrifugeMobs.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/CentrifugeMobs.java index 1978cc958..bd2a3f9c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/CentrifugeMobs.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/CentrifugeMobs.java @@ -135,7 +135,9 @@ public RecipeBuilder chance(List chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Centrifuge recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Centrifuge recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Charger.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Charger.java index d6a7898e1..3dd75677d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Charger.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Charger.java @@ -105,7 +105,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Charger recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Charger recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Compactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Compactor.java index 942b9bd38..c37b02f33 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Compactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Compactor.java @@ -163,7 +163,9 @@ public RecipeBuilder mode(CompactorManager.Mode mode) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Compactor recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Compactor recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Crucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Crucible.java index 1cf88e895..535f4748c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Crucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Crucible.java @@ -121,7 +121,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Crucible recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Crucible recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Enchanter.java index 7ece738a0..242c04ebb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Enchanter.java @@ -168,7 +168,9 @@ public RecipeBuilder type(EnchanterManager.Type type) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Enchanter recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Enchanter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Extruder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Extruder.java index 5f552a68a..388decf0e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Extruder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Extruder.java @@ -191,7 +191,9 @@ public RecipeBuilder sedimentary(boolean sedimentary) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Extruder recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Extruder recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Furnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Furnace.java index fd08dba7a..bb9bfb0be 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Furnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Furnace.java @@ -124,7 +124,9 @@ public RecipeBuilder energy(int energy) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Furnace recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Furnace recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/FurnacePyrolysis.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/FurnacePyrolysis.java index dd5cc6b09..52575019d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/FurnacePyrolysis.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/FurnacePyrolysis.java @@ -113,7 +113,9 @@ public RecipeBuilder creosote(int creosote) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Furnace Pyrolysis recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Furnace Pyrolysis recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Insolator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Insolator.java index b1cf5872c..61c23a157 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Insolator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Insolator.java @@ -189,7 +189,9 @@ public RecipeBuilder standard() { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Insolator recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Insolator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Precipitator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Precipitator.java index c59a9427c..6e4c3f23c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Precipitator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Precipitator.java @@ -123,7 +123,9 @@ public RecipeBuilder water(int water) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Precipitator recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Precipitator recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Pulverizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Pulverizer.java index 62219092a..38adb16dd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Pulverizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Pulverizer.java @@ -114,7 +114,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Pulverizer recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Pulverizer recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Refinery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Refinery.java index 231c66620..85a6cc4ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Refinery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Refinery.java @@ -198,7 +198,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Refinery recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Refinery recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/RefineryPotion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/RefineryPotion.java index 8036ee456..67a270eb3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/RefineryPotion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/RefineryPotion.java @@ -117,7 +117,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Refinery recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Refinery recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Sawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Sawmill.java index c0ad546c5..2ea8f99a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Sawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Sawmill.java @@ -112,7 +112,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Sawmill recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Sawmill recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Smelter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Smelter.java index 3f5067680..2fda0bfad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Smelter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/Smelter.java @@ -144,7 +144,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Smelter recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Smelter recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerExtract.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerExtract.java index 8743c682f..3c036fde6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerExtract.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerExtract.java @@ -131,7 +131,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Transposer Extract recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Transposer Extract recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerFill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerFill.java index fbc01fb56..414a8b389 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerFill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/machine/TransposerFill.java @@ -140,7 +140,9 @@ public RecipeBuilder chance(int chance) { } @Override - public String getErrorMsg() { return "Error adding Thermal Expansion Transposer Fill recipe"; } + public String getErrorMsg() { + return "Error adding Thermal Expansion Transposer Fill recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Alloying.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Alloying.java index 17b223215..f28af10d1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Alloying.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Alloying.java @@ -113,7 +113,9 @@ public SimpleObjectStream streamRecipes() { public class RecipeBuilder extends AbstractRecipeBuilder { @Override - public String getErrorMsg() { return "Error adding Tinkers Construct Alloying recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Construct Alloying recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java index 221444dea..7dd7c21eb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java @@ -136,7 +136,9 @@ public RecipeBuilder cast(IIngredient ingredient) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Construct Casting Basin recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Construct Casting Basin recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java index 2f577c98f..c9157df65 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java @@ -136,7 +136,9 @@ public RecipeBuilder cast(IIngredient ingredient) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Construct Casting Table recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Construct Casting Table recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java index 8b820f1c4..2c60dc54d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java @@ -116,7 +116,9 @@ public RecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding Tinkers Construct Drying recipe"; } + public String getErrorMsg() { + return "Error adding Tinkers Construct Drying recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/EntityMelting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/EntityMelting.java index 4d26419d8..da0d7dec8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/EntityMelting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/EntityMelting.java @@ -131,7 +131,9 @@ public RecipeBuilder input(EntityEntry entity) { return input(entity.getRegistryName()); } - private String getErrorMsg() { return "Error adding Tinkers Construct Entity Melting recipe"; } + private String getErrorMsg() { + return "Error adding Tinkers Construct Entity Melting recipe"; + } private void validate(GroovyLog.Msg msg) { msg.add(input == null || EntityList.getClass(input) == null, "Expected valid entity name, got " + input); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/SmelteryFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/SmelteryFuel.java index f3f9f5f57..0c81b7c15 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/SmelteryFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/SmelteryFuel.java @@ -21,8 +21,7 @@ public class SmelteryFuel extends VirtualizedRegistry { @Override @GroovyBlacklist protected AbstractReloadableStorage createRecipeStorage() { - return new AbstractReloadableStorage<>() - { + return new AbstractReloadableStorage<>() { @Override @GroovyBlacklist protected boolean compareRecipe(SmelteryFuelRecipe recipe, SmelteryFuelRecipe recipe2) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterial.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterial.java index fd43e7bb4..c5b2289ac 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterial.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterial.java @@ -44,16 +44,24 @@ public GroovyMaterial addItem(IIngredient item, int amountNeeded, int amountMatc } @Override - public boolean isHidden() { return hidden; } + public boolean isHidden() { + return hidden; + } @Override - public ItemStack getRepresentativeItem() { return representativeItem.getMatchingStacks()[0]; } + public ItemStack getRepresentativeItem() { + return representativeItem.getMatchingStacks()[0]; + } @Override - public ItemStack getShard() { return shard != null ? shard.getMatchingStacks()[0] : ItemStack.EMPTY; } + public ItemStack getShard() { + return shard != null ? shard.getMatchingStacks()[0] : ItemStack.EMPTY; + } @Override - public void setShard(@NotNull ItemStack stack) { this.shard = new ItemsIngredient(stack); } + public void setShard(@NotNull ItemStack stack) { + this.shard = new ItemsIngredient(stack); + } @Override public boolean hasFluid() { @@ -61,7 +69,9 @@ public boolean hasFluid() { } @Override - public Fluid getFluid() { return fluidStack != null ? fluidStack.getFluid() : null; } + public Fluid getFluid() { + return fluidStack != null ? fluidStack.getFluid() : null; + } @Override public Material setFluid(Fluid fluid) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/ToolMaterialBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/ToolMaterialBuilder.java index 01a1251e4..c8a98db13 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/ToolMaterialBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/ToolMaterialBuilder.java @@ -139,11 +139,17 @@ public ToolMaterialBuilder isCastable(boolean castable) { return this; } - public ToolMaterialBuilder isHidden() { return isHidden(!hidden); } + public ToolMaterialBuilder isHidden() { + return isHidden(!hidden); + } - public ToolMaterialBuilder isCraftable() { return isCraftable(!craftable); } + public ToolMaterialBuilder isCraftable() { + return isCraftable(!craftable); + } - public ToolMaterialBuilder isCastable() { return isCastable(!castable); } + public ToolMaterialBuilder isCastable() { + return isCastable(!castable); + } public ToolMaterialBuilder addHeadStats(int durability, float miningSpeed, float attackDamage, int harvestLevel) { this.stats.put(MaterialTypes.HEAD, new HeadMaterialStats(durability, miningSpeed, attackDamage, harvestLevel)); @@ -201,7 +207,9 @@ public ToolMaterialBuilder addTrimStats(float durability) { return this; } - public String getErrorMsg() { return "Error adding Tinkers' Construct Material"; } + public String getErrorMsg() { + return "Error adding Tinkers' Construct Material"; + } public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg(this.getErrorMsg()).error(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java index dc3bc2208..51ac72e95 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java @@ -51,7 +51,9 @@ public MeltingRecipeBuilder time(int time) { } @Override - public String getErrorMsg() { return "Error adding " + recipeName; } + public String getErrorMsg() { + return "Error adding " + recipeName; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Drops.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Drops.java index e092f65bd..2ebaa9f9c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Drops.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Drops.java @@ -211,7 +211,9 @@ public RecipeBuilder size(Collection sizes) { } @Override - public String getErrorMsg() { return "Error adding Woot custom drops"; } + public String getErrorMsg() { + return "Error adding Woot custom drops"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/MobConfig.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/MobConfig.java index 4aaff5471..aaa4183ea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/MobConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/MobConfig.java @@ -95,11 +95,13 @@ public void remove(String name, String key) { @MethodDescription(description = "groovyscript.wiki.woot.mob_config.removeByEntity", example = @Example("'minecraft:wither'")) public void remove(WootMobName name) { - for (Map.Entry entry : ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMobMap() - .entrySet().stream() - .filter(x -> x.getKey() - .startsWith(name.toString())) - .collect(Collectors.toList())) { + for ( + Map.Entry entry : ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMobMap() + .entrySet().stream() + .filter(x -> x.getKey() + .startsWith(name.toString())) + .collect(Collectors.toList()) + ) { addBackup(Pair.of(entry.getKey(), entry.getValue())); ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMobMap().remove(entry.getKey()); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Spawning.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Spawning.java index 40d4258a8..14b133ffd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Spawning.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Spawning.java @@ -154,7 +154,9 @@ public RecipeBuilder name(String name) { //} @Override - public String getErrorMsg() { return "Error adding Woot custom spawning costs"; } + public String getErrorMsg() { + return "Error adding Woot custom spawning costs"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java index 0571aa700..99a6b06f6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java @@ -125,7 +125,9 @@ public RecipeBuilder preserveBase() { } @Override - public String getErrorMsg() { return "Error adding Woot Stygian Iron Anvil recipe"; } + public String getErrorMsg() { + return "Error adding Woot Stygian Iron Anvil recipe"; + } @Override public void validate(GroovyLog.Msg msg) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java index 11b3a3b65..4a1872f8e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java @@ -131,8 +131,10 @@ public void removeByInput(IIngredient input, boolean log) { } List recipesToRemove = new ArrayList<>(); for (IRecipe recipe : ForgeRegistries.RECIPES) { - if (recipe.getRegistryName() != null && !recipe.getIngredients().isEmpty() && recipe.getIngredients().stream() - .anyMatch(i -> i.getMatchingStacks().length > 0 && input.test(i.getMatchingStacks()[0]))) { + if ( + recipe.getRegistryName() != null && !recipe.getIngredients().isEmpty() && recipe.getIngredients().stream() + .anyMatch(i -> i.getMatchingStacks().length > 0 && input.test(i.getMatchingStacks()[0])) + ) { recipesToRemove.add(recipe.getRegistryName()); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingInfo.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingInfo.java index 8bb7f84e8..157f12703 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingInfo.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingInfo.java @@ -18,14 +18,22 @@ public CraftingInfo(InventoryCrafting inventory, @UnknownNullability EntityPlaye this.world = player == null ? null : player.world; } - public InventoryCrafting getInventory() { return this.inventory; } + public InventoryCrafting getInventory() { + return this.inventory; + } - public EntityPlayer getPlayer() { return player; } + public EntityPlayer getPlayer() { + return player; + } public int getDimension() { - if (this.world != null) { return this.world.provider.getDimension(); } + if (this.world != null) { + return this.world.provider.getDimension(); + } return 0; } - public World getWorld() { return this.world; } + public World getWorld() { + return this.world; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java index 70c5b1992..412098791 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java @@ -73,20 +73,28 @@ public CraftingRecipe(ItemStack output, List input, @Nullable Closu } @Override - public @NotNull ItemStack getRecipeOutput() { return output; } + public @NotNull ItemStack getRecipeOutput() { + return output; + } @Nullable @Override - public Closure getRecipeAction() { return recipeAction; } + public Closure getRecipeAction() { + return recipeAction; + } @Nullable @Override - public Closure getRecipeFunction() { return recipeFunction; } + public Closure getRecipeFunction() { + return recipeFunction; + } public boolean matches(@Nullable IIngredient expectedInput, ItemStack givenInput) { return expectedInput == null || expectedInput.test(givenInput); } @Override - public @NotNull NonNullList getIngredients() { return this.ingredients; } + public @NotNull NonNullList getIngredients() { + return this.ingredients; + } @Override public @NotNull NonNullList getRemainingItems(@NotNull InventoryCrafting inv) { @@ -95,11 +103,13 @@ public boolean matches(@Nullable IIngredient expectedInput, ItemStack givenInput ItemStack input = matchResult.getGivenInput(); ItemStack remainder = matchResult.getRecipeIngredient().applyTransform(input.copy()); if (remainder == null) remainder = ItemStack.EMPTY; - else if (input.getCount() > 1 && !remainder.isEmpty() && ItemStack.areItemsEqual(input, remainder) && ItemStack - .areItemStackTagsEqual(input, - remainder)) { - remainder.setCount(1); - } + else if ( + input.getCount() > 1 && !remainder.isEmpty() && ItemStack.areItemsEqual(input, remainder) && ItemStack + .areItemStackTagsEqual(input, + remainder) + ) { + remainder.setCount(1); + } result.set(matchResult.getSlotIndex(), remainder); } return result; @@ -122,8 +132,7 @@ public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { */ public static class MatchList extends ArrayList { - public static final MatchList EMPTY = new MatchList() - { + public static final MatchList EMPTY = new MatchList() { @Override public boolean add(SlotMatchResult slotMatchResult) { @@ -148,11 +157,17 @@ public SlotMatchResult(IIngredient recipeIngredient, ItemStack givenInput, int s this.slotIndex = slotIndex; } - public IIngredient getRecipeIngredient() { return recipeIngredient; } + public IIngredient getRecipeIngredient() { + return recipeIngredient; + } - public ItemStack getGivenInput() { return givenInput; } + public ItemStack getGivenInput() { + return givenInput; + } - public int getSlotIndex() { return slotIndex; } + public int getSlotIndex() { + return slotIndex; + } } // TODO @@ -160,7 +175,9 @@ private static EntityPlayer getPlayerFromInventory(InventoryCrafting inventory) Container eventHandler = ((InventoryCraftingAccess) inventory).getEventHandler(); if (eventHandler != null) { for (Slot slot : eventHandler.inventorySlots) { - if (slot instanceof SlotCraftingAccess) { return ((SlotCraftingAccess) slot).getPlayer(); } + if (slot instanceof SlotCraftingAccess) { + return ((SlotCraftingAccess) slot).getPlayer(); + } } } return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java index 988ba69da..14c415f5c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java @@ -20,7 +20,9 @@ public Shaped() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_shaped_"; } + public String getRecipeNamePrefix() { + return "groovyscript_shaped_"; + } @Override @RecipeBuilderRegistrationMethod public IRecipe register() { @@ -74,17 +76,21 @@ public Shapeless() { } @Override - public String getRecipeNamePrefix() { return "groovyscript_shapeless_"; } + public String getRecipeNamePrefix() { + return "groovyscript_shapeless_"; + } @Override @RecipeBuilderRegistrationMethod public IRecipe register() { validateName(); IngredientHelper.trim(ingredients); GroovyLog.Msg msg = GroovyLog.msg("Error adding Minecraft Shapeless Crafting recipe '{}'", this.name); - if (msg.add(IngredientHelper.isEmpty(this.output), () -> "Output must not be empty").add(ingredients.isEmpty(), + if ( + msg.add(IngredientHelper.isEmpty(this.output), () -> "Output must not be empty").add(ingredients.isEmpty(), () -> "inputs must not be empty") .add(ingredients.size() > width * height, () -> "maximum inputs are " + (width * height) + " but found " + - ingredients.size()).error().postIfNotEmpty()) { + ingredients.size()).error().postIfNotEmpty() + ) { return null; } handleReplace(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java index e1a572067..4852e0b36 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java @@ -28,11 +28,13 @@ public void add(IIngredient input, ItemStack output) { } public void add(IIngredient input, ItemStack output, float exp) { - if (GroovyLog.msg("Error adding Minecraft Furnace recipe").add(IngredientHelper.isEmpty(input), + if ( + GroovyLog.msg("Error adding Minecraft Furnace recipe").add(IngredientHelper.isEmpty(input), () -> "Input must not be empty").add(IngredientHelper .isEmpty(output), () -> "Output must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } if (exp < 0) { @@ -200,7 +202,9 @@ public RecipeBuilder exp(float exp) { } @Override - public String getErrorMsg() { return "Error adding Minecraft Furnace recipe"; } + public String getErrorMsg() { + return "Error adding Minecraft Furnace recipe"; + } @Override public void validate(GroovyLog.Msg msg) { @@ -235,10 +239,16 @@ private Recipe(ItemStack input, ItemStack output, float exp) { this.exp = exp; } - public ItemStack getInput() { return input.copy(); } + public ItemStack getInput() { + return input.copy(); + } - public ItemStack getOutput() { return output.copy(); } + public ItemStack getOutput() { + return output.copy(); + } - public float getExp() { return exp; } + public float getExp() { + return exp; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java index 585f9d148..f2f8de89b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java @@ -13,8 +13,7 @@ @GroovyBlacklist public class FurnaceRecipeManager { - public static final ObjectOpenCustomHashSet inputMap = new ObjectOpenCustomHashSet<>(new Hash.Strategy<>() - { + public static final ObjectOpenCustomHashSet inputMap = new ObjectOpenCustomHashSet<>(new Hash.Strategy<>() { @Override public int hashCode(ItemStack o) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java index 690dc3334..7b4fa3864 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java @@ -48,7 +48,9 @@ static ItemStackMixinExpansion of(ItemStack stack) { @Override default ItemStackMixinExpansion exactCopy() { - if (grs$isEmpty()) { return (ItemStackMixinExpansion) (Object) ItemStack.EMPTY; } + if (grs$isEmpty()) { + return (ItemStackMixinExpansion) (Object) ItemStack.EMPTY; + } ItemStackMixinExpansion copy = of(grs$getItemStack().copy()); copy.setMark(getMark()); copy.grs$setTransformer(grs$getTransformer()); @@ -59,8 +61,10 @@ default ItemStackMixinExpansion exactCopy() { @Override default boolean test(ItemStack stack) { - if (!OreDictionary.itemMatches(grs$getItemStack(), stack, false) && (grs$getMatcher() == null || !grs$getMatcher().test( - stack))) { + if ( + !OreDictionary.itemMatches(grs$getItemStack(), stack, false) && (grs$getMatcher() == null || !grs$getMatcher().test( + stack)) + ) { return false; } if (grs$getNbtMatcher() != null) { @@ -133,10 +137,14 @@ default Ingredient toMcIngredient() { } @Override - default ItemStack[] getMatchingStacks() { return new ItemStack[]{IngredientHelper.toItemStack(exactCopy())}; } + default ItemStack[] getMatchingStacks() { + return new ItemStack[]{IngredientHelper.toItemStack(exactCopy())}; + } @Override - default int getAmount() { return grs$getItemStack().getCount(); } + default int getAmount() { + return grs$getItemStack().getCount(); + } @Override default void setAmount(int amount) { @@ -145,7 +153,9 @@ default void setAmount(int amount) { @Override - default @Nullable NBTTagCompound getNbt() { return grs$getItemStack().getTagCompound(); } + default @Nullable NBTTagCompound getNbt() { + return grs$getItemStack().getTagCompound(); + } @Override default void setNbt(NBTTagCompound nbt) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java index 74973ba84..67b1e8b5b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java @@ -39,10 +39,12 @@ public void add(String name, Block block) { } public void add(String name, ItemStack stack) { - if (GroovyLog.msg("Error adding ore dictionary entry").add(StringUtils.isEmpty(name), () -> "Name must not be empty").add( + if ( + GroovyLog.msg("Error adding ore dictionary entry").add(StringUtils.isEmpty(name), () -> "Name must not be empty").add( IngredientHelper.isEmpty(stack), () -> "Item must not be empty") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } add(new OreDictEntry(name, stack)); @@ -73,8 +75,10 @@ public boolean isCase(String name) { } public boolean remove(String name, ItemStack stack) { - if (GroovyLog.msg("Error removing ore dictionary entry").add(StringUtils.isEmpty(name), () -> "Name must not be empty") - .add(IngredientHelper.isEmpty(stack), () -> "Item must not be empty").error().postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing ore dictionary entry").add(StringUtils.isEmpty(name), () -> "Name must not be empty") + .add(IngredientHelper.isEmpty(stack), () -> "Item must not be empty").error().postIfNotEmpty() + ) { return false; } return remove(name, stack, true); @@ -113,8 +117,10 @@ public boolean clear(String name) { public boolean removeAll(String name) { List list = getItems(name); - if (GroovyLog.msg("Error removing from OreDictionary entry").add(list.isEmpty(), "OreDictionary Entry was empty").error() - .postIfNotEmpty()) { + if ( + GroovyLog.msg("Error removing from OreDictionary entry").add(list.isEmpty(), "OreDictionary Entry was empty").error() + .postIfNotEmpty() + ) { return false; } list.forEach(stack -> remove(name, stack)); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java index e35943010..d30acb53e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java @@ -34,8 +34,10 @@ public void addToInventory(InventoryPlayer playerInv) { } else { if (entry.getValue().isEmpty()) continue; - if (playerInv.getStackInSlot(entry.getKey()).isEmpty() || playerInv.getStackInSlot(entry.getKey()).equals(entry - .getValue())) { + if ( + playerInv.getStackInSlot(entry.getKey()).isEmpty() || playerInv.getStackInSlot(entry.getKey()).equals(entry + .getValue()) + ) { playerInv.add(entry.getKey(), entry.getValue().copy()); } else { GroovyLog.msg("Could not set inventory slot {} to itemstack {}", entry.getKey(), entry.getValue()).error() diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java index e3d9d7371..b80be75ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java @@ -26,7 +26,9 @@ public class Rarity extends NamedRegistry { public IRarity check(ItemStack testStack) { for (Pair, IRarity> pair : this.rarities) { - if (ClosureHelper.call(false, pair.getKey(), testStack)) { return pair.getValue(); } + if (ClosureHelper.call(false, pair.getKey(), testStack)) { + return pair.getValue(); + } } return testStack.getItem().getRarity(testStack); } @@ -52,9 +54,11 @@ public void set(TextFormatting color, String rarityName, Closure predic } public void set(IRarity rarity, Closure predicate) { - if (GroovyLog.msg("Error setting Item Rarity").add(rarity == null, () -> "Rarity must not be null").add(predicate == null, + if ( + GroovyLog.msg("Error setting Item Rarity").add(rarity == null, () -> "Rarity must not be null").add(predicate == null, () -> "Predicate must not be null") - .error().postIfNotEmpty()) { + .error().postIfNotEmpty() + ) { return; } rarities.add(Pair.of(predicate, rarity)); @@ -86,10 +90,14 @@ private RarityImpl(TextFormatting color, String name) { } @Override - public TextFormatting getColor() { return color; } + public TextFormatting getColor() { + return color; + } @Override - public String getName() { return name; } + public String getName() { + return name; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ShapedCraftingRecipe.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ShapedCraftingRecipe.java index 806a89926..0305f2180 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ShapedCraftingRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ShapedCraftingRecipe.java @@ -33,12 +33,18 @@ public boolean canFit(int width, int height) { } @Override - public int getRecipeWidth() { return width; } + public int getRecipeWidth() { + return width; + } @Override - public int getRecipeHeight() { return height; } + public int getRecipeHeight() { + return height; + } - public boolean isMirrored() { return mirrored; } + public boolean isMirrored() { + return mirrored; + } @Override public @NotNull MatchList getMatchingList(InventoryCrafting inv) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java index f2bbb9a8c..9d79c312a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/VanillaModule.java @@ -59,5 +59,7 @@ public void afterScriptLoad() { } @Override - public Collection getAliases() { return Collections.emptyList(); } + public Collection getAliases() { + return Collections.emptyList(); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptCore.java b/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptCore.java index 27783018f..7c58c8fe4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptCore.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptCore.java @@ -19,13 +19,19 @@ public class GroovyScriptCore implements IFMLLoadingPlugin, IEarlyMixinLoader { public static File source; @Override - public String[] getASMTransformerClass() { return new String[0]; } + public String[] getASMTransformerClass() { + return new String[0]; + } @Override - public String getModContainerClass() { return "com.cleanroommc.groovyscript.sandbox.ScriptModContainer"; } + public String getModContainerClass() { + return "com.cleanroommc.groovyscript.sandbox.ScriptModContainer"; + } @Nullable @Override - public String getSetupClass() { return null; } + public String getSetupClass() { + return null; + } @Override public void injectData(Map data) { @@ -33,8 +39,12 @@ public void injectData(Map data) { } @Override - public String getAccessTransformerClass() { return "com.cleanroommc.groovyscript.core.GroovyScriptTransformer"; } + public String getAccessTransformerClass() { + return "com.cleanroommc.groovyscript.core.GroovyScriptTransformer"; + } @Override - public List getMixinConfigs() { return ImmutableList.of("mixin.groovyscript.json"); } + public List getMixinConfigs() { + return ImmutableList.of("mixin.groovyscript.json"); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/LateMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/LateMixin.java index 9bfc468ec..1d4af23fe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/LateMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/LateMixin.java @@ -32,7 +32,9 @@ public boolean shouldMixinConfigQueue(String mixinConfig) { } public boolean shouldEnableModMixin(String mod) { - if (mod.startsWith("ic2")) { return Loader.isModLoaded("ic2") && mod.endsWith("exp") == IC2.isExp(); } + if (mod.startsWith("ic2")) { + return Loader.isModLoaded("ic2") && mod.endsWith("exp") == IC2.isExp(); + } return Loader.isModLoaded(mod); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java index 9964f4f44..81fd95446 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java @@ -32,9 +32,11 @@ public void onUpdate(CallbackInfo ci) { BlockPos pos = new BlockPos(thisEntity); IBlockState blockState = thisEntity.world.getBlockState(pos); Fluid fluid = FluidRecipe.getFluid(blockState); - if (fluid != null && FluidRecipe.isSourceBlock(blockState) && FluidRecipe.findAndRunRecipe(fluid, thisEntity.world, + if ( + fluid != null && FluidRecipe.isSourceBlock(blockState) && FluidRecipe.findAndRunRecipe(fluid, thisEntity.world, pos, - blockState) && thisEntity.isDead) { + blockState) && thisEntity.isDead + ) { ci.cancel(); return; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java index 2ede26ac6..8642dabd7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java @@ -32,7 +32,9 @@ public void register(Class eventClass, EventPriority priority, IEventListener Event event = (Event) ctor.newInstance(); event.getListenerList().register(busID, priority, listener); listeners.computeIfAbsent(listener, k -> new ArrayList<>()).add(listener); - } catch (ReflectiveOperationException e) { + } catch ( + ReflectiveOperationException e + ) { e.printStackTrace(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/FluidStackMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/FluidStackMixin.java index 6581562cc..c584379e8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/FluidStackMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/FluidStackMixin.java @@ -65,10 +65,14 @@ public Ingredient toMcIngredient() { } @Override - public ItemStack[] getMatchingStacks() { return new ItemStack[0]; } + public ItemStack[] getMatchingStacks() { + return new ItemStack[0]; + } @Override - public boolean isEmpty() { return getAmount() <= 0; } + public boolean isEmpty() { + return getAmount() <= 0; + } @Override public boolean test(ItemStack stack) { @@ -87,7 +91,9 @@ public boolean test(ItemStack stack) { @Override public boolean test(FluidStack fluidStack) { - if (fluidStack == null) { return false; } + if (fluidStack == null) { + return false; + } if (nbtMatcher != null) { NBTTagCompound nbt = fluidStack.tag; return nbt != null && ClosureHelper.call(true, nbtMatcher, nbt); @@ -157,14 +163,22 @@ public INbtIngredient whenAnyNbt() { } @Override - public @Nullable NBTTagCompound getNbt() { return tag; } + public @Nullable NBTTagCompound getNbt() { + return tag; + } @Override - public void setNbt(NBTTagCompound nbt) { this.tag = nbt; } + public void setNbt(NBTTagCompound nbt) { + this.tag = nbt; + } @Override - public int getAmount() { return amount; } + public int getAmount() { + return amount; + } @Override - public void setAmount(int amount) { this.amount = amount; } + public void setAmount(int amount) { + this.amount = amount; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java index c5c27c92b..c22c6a292 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java @@ -199,7 +199,9 @@ public abstract class ForgeRegistryMixin> imple @Unique @Nullable public V groovyScript$getDummy(ResourceLocation rl) { - if (dummyFactory != null) { return dummyFactory.createDummy(rl); } + if (dummyFactory != null) { + return dummyFactory.createDummy(rl); + } if (groovyScript$dummySupplier == null) { groovyScript$dummySupplier = ReloadableRegistryManager.getDummySupplier(getRegistrySuperType()); } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemStackMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemStackMixin.java index 5b3638d52..aca3201e5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemStackMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemStackMixin.java @@ -66,8 +66,12 @@ public abstract class ItemStackMixin implements ItemStackMixinExpansion { } @Nullable @Override - public String getMark() { return groovyScript$mark; } + public String getMark() { + return groovyScript$mark; + } @Override - public void setMark(String mark) { this.groovyScript$mark = mark; } + public void setMark(String mark) { + this.groovyScript$mark = mark; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationMapEffectRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationMapEffectRegistryAccessor.java index 5ff0bfe0b..48ebc4a5c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationMapEffectRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationMapEffectRegistryAccessor.java @@ -12,6 +12,8 @@ public interface ConstellationMapEffectRegistryAccessor { @Accessor - static Map getEffectRegistry() { return null; } + static Map getEffectRegistry() { + return null; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LightOreTransmutationsAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LightOreTransmutationsAccessor.java index c32e25d6b..8540e0e25 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LightOreTransmutationsAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LightOreTransmutationsAccessor.java @@ -11,6 +11,8 @@ public interface LightOreTransmutationsAccessor { @Accessor - static Collection getRegisteredTransmutations() { return null; } + static Collection getRegisteredTransmutations() { + return null; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LiquidInteractionAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LiquidInteractionAccessor.java index c1223f5e8..8992c2216 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LiquidInteractionAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/LiquidInteractionAccessor.java @@ -11,7 +11,9 @@ public interface LiquidInteractionAccessor { @Accessor - static List getRegisteredInteractions() { return null; } + static List getRegisteredInteractions() { + return null; + } @Accessor("action") LiquidInteraction.FluidInteractionAction getFluidInteractionAction(); diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/botania/PageCraftingRecipeMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/botania/PageCraftingRecipeMixin.java index 62f7b7854..34753f828 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/botania/PageCraftingRecipeMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/botania/PageCraftingRecipeMixin.java @@ -46,8 +46,12 @@ public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) { int x; int y; int index; - if (!(recipe instanceof ShapedRecipes) && !(recipe instanceof ShapedOreRecipe) && !(recipe instanceof ShapedCraftingRecipe)) { - if (recipe instanceof ShapelessRecipes || recipe instanceof ShapelessOreRecipe || recipe instanceof ShapelessCraftingRecipe) { + if ( + !(recipe instanceof ShapedRecipes) && !(recipe instanceof ShapedOreRecipe) && !(recipe instanceof ShapedCraftingRecipe) + ) { + if ( + recipe instanceof ShapelessRecipes || recipe instanceof ShapelessOreRecipe || recipe instanceof ShapelessCraftingRecipe + ) { this.shapelessRecipe = true; this.oreDictRecipe = recipe instanceof ShapelessOreRecipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileEnergyStorageCoreMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileEnergyStorageCoreMixin.java index 17ba330d7..ebdd773ec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileEnergyStorageCoreMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileEnergyStorageCoreMixin.java @@ -26,7 +26,9 @@ public abstract class TileEnergyStorageCoreMixin { public void update(CallbackInfo ci) { if (!GroovyScriptConfig.compat.draconicEvolutionEnergyCore) return; TileEnergyStorageCore tile = (TileEnergyStorageCore) (Object) this; - if (!tile.getWorld().isRemote && ticksElapsed % 500 != 0 && ((BlockStateEnergyCoreStructure) tile.coreStructure).checkVersion()) { + if ( + !tile.getWorld().isRemote && ticksElapsed % 500 != 0 && ((BlockStateEnergyCoreStructure) tile.coreStructure).checkVersion() + ) { validateStructure(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileInvisECoreBlockMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileInvisECoreBlockMixin.java index c8aaaa59b..9a92ed038 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileInvisECoreBlockMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/TileInvisECoreBlockMixin.java @@ -25,7 +25,9 @@ public class TileInvisECoreBlockMixin implements TileInvisECoreBlockState { int metadata; @Override - public boolean getDefault() { return isDefault; } + public boolean getDefault() { + return isDefault; + } @Override public void setIsDefault() { @@ -34,7 +36,9 @@ public void setIsDefault() { } @Override - public int getMetadata() { return metadata; } + public int getMetadata() { + return metadata; + } @Override public void setMetadata(int metadata) { diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extendedcrafting/ItemRecipeMakerMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extendedcrafting/ItemRecipeMakerMixin.java index ffb21349f..19c6bad4a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extendedcrafting/ItemRecipeMakerMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extendedcrafting/ItemRecipeMakerMixin.java @@ -119,9 +119,13 @@ public void setClipboard(IExtendedTable table, ItemStack stack, CallbackInfoRetu private static String groovyscript$makeItem(ItemStack stack) { if (ModConfig.confRMOredict) { int[] oreIds = OreDictionary.getOreIDs(stack); - if (oreIds.length > 0) { return IngredientHelper.asGroovyCode(OreDictionary.getOreName(oreIds[0]), false); } + if (oreIds.length > 0) { + return IngredientHelper.asGroovyCode(OreDictionary.getOreName(oreIds[0]), false); + } + } + if (ModConfig.confRMNBT) { + return IngredientHelper.asGroovyCode(stack, false, false); } - if (ModConfig.confRMNBT) { return IngredientHelper.asGroovyCode(stack, false, false); } return IngredientHelper.asGroovyCode(stack, false); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/AsmDecompilerMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/AsmDecompilerMixin.java index 2a1c2d399..0dc2b03fd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/AsmDecompilerMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/AsmDecompilerMixin.java @@ -38,7 +38,9 @@ private static void parseClass(URL url, CallbackInfoReturnable cir) { URI uri; try { uri = url.toURI(); - } catch (URISyntaxException e) { + } catch ( + URISyntaxException e + ) { throw new GroovyRuntimeException(e); } @@ -62,8 +64,10 @@ private static void parseClass(URL url, CallbackInfoReturnable cir) { classReader2.accept(decompiler, ClassReader.SKIP_FRAMES); stub = AsmDecompileHelper.getDecompiledClass(decompiler); stubCache.put(uri, new SoftReference<>(stub)); - } catch (IOException | ClassNotFoundException | NoSuchFieldException | NoSuchMethodException | - IllegalAccessException | InvocationTargetException | InstantiationException e) { + } catch ( + IOException | ClassNotFoundException | NoSuchFieldException | NoSuchMethodException | + IllegalAccessException | InvocationTargetException | InstantiationException e + ) { throw new RuntimeException(e); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java index 31d385a74..e453a0c97 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/Java8Mixin.java @@ -106,10 +106,14 @@ public void configureClassNode(final CompileUnit compileUnit, final ClassNode cl if (packageNode != null) { setAnnotationMetaData(clazz.getPackage().getAnnotations(), packageNode); } - } catch (NoClassDefFoundError e) { + } catch ( + NoClassDefFoundError e + ) { throw new NoClassDefFoundError("Unable to load class " + classNode.toString(false) + " due to missing dependency " + e .getMessage()); - } catch (MalformedParameterizedTypeException e) { + } catch ( + MalformedParameterizedTypeException e + ) { throw new RuntimeException("Unable to configure class node for class " + classNode.toString(false) + " due to malformed parameterized types", e); } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/MetaClassImplMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/MetaClassImplMixin.java index 70699b854..2b4819258 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/MetaClassImplMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/MetaClassImplMixin.java @@ -82,7 +82,9 @@ public void invokeMethod(Class sender, Object object, String methodName, Obje boolean fromInsideClass, CallbackInfoReturnable cir) { try { cir.setReturnValue(doInvokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass)); - } catch (MissingMethodException mme) { + } catch ( + MissingMethodException mme + ) { throw new GroovyRuntimeException(mme); } } @@ -156,7 +158,9 @@ private Object invokePropertyOrMissing(Object object, String methodName, Object[ try { MetaClass metaClass = ((MetaClassRegistryImpl) registry).getMetaClass(value); return metaClass.invokeMethod(value, "call", originalArguments); // delegate to call method of property value - } catch (MissingMethodException mme) { + } catch ( + MissingMethodException mme + ) { // ignore } } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/mekanism/GasStackMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/mekanism/GasStackMixin.java index 547f047b7..6a73cf0b0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/mekanism/GasStackMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/mekanism/GasStackMixin.java @@ -21,10 +21,14 @@ public abstract class GasStackMixin implements IIngredient, IResourceStack { public abstract GasStack copy(); @Override - public int getAmount() { return amount; } + public int getAmount() { + return amount; + } @Override - public void setAmount(int amount) { this.amount = amount; } + public void setAmount(int amount) { + this.amount = amount; + } @Override public IIngredient exactCopy() { @@ -37,7 +41,9 @@ public Ingredient toMcIngredient() { } @Override - public ItemStack[] getMatchingStacks() { return new ItemStack[0]; } + public ItemStack[] getMatchingStacks() { + return new ItemStack[0]; + } @Override public boolean test(ItemStack stack) { diff --git a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassConstructorsVisitor.java b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassConstructorsVisitor.java index fef7a6981..a02f4f450 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassConstructorsVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassConstructorsVisitor.java @@ -18,7 +18,9 @@ public CachedClassConstructorsVisitor(ClassVisitor cv) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - if (name.equals(METHOD_NAME)) { return new InitConstructorVisitor(mv); } + if (name.equals(METHOD_NAME)) { + return new InitConstructorVisitor(mv); + } return mv; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassFieldsVisitor.java b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassFieldsVisitor.java index 866b8a34b..2605be7c4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassFieldsVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassFieldsVisitor.java @@ -18,7 +18,9 @@ public CachedClassFieldsVisitor(ClassVisitor cv) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - if (name.equals(METHOD_NAME)) { return new InitFieldVisitor(mv); } + if (name.equals(METHOD_NAME)) { + return new InitFieldVisitor(mv); + } return mv; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassMethodsVisitor.java b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassMethodsVisitor.java index d4ed07e57..389bdb7b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassMethodsVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/CachedClassMethodsVisitor.java @@ -18,7 +18,9 @@ public CachedClassMethodsVisitor(ClassVisitor cv) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - if (name.equals(METHOD_NAME)) { return new InitMethodVisitor(mv); } + if (name.equals(METHOD_NAME)) { + return new InitMethodVisitor(mv); + } return mv; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/visitors/InvokerHelperVisitor.java b/src/main/java/com/cleanroommc/groovyscript/core/visitors/InvokerHelperVisitor.java index f23535ece..0eea73884 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/InvokerHelperVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/InvokerHelperVisitor.java @@ -22,7 +22,9 @@ public InvokerHelperVisitor(ClassWriter writer) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor visitor = super.visitMethod(access, name, desc, signature, exceptions); - if (CREATE_MAP_METHOD.equals(name)) { return new CreateMapVisitor(visitor); } + if (CREATE_MAP_METHOD.equals(name)) { + return new CreateMapVisitor(visitor); + } return visitor; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java b/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java index 4030ff775..9ce520c17 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java @@ -17,7 +17,9 @@ public StaticVerifierVisitor(ClassVisitor cv) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - if (name.equals(METHOD)) { return new VisitVariableVisitor(mv); } + if (name.equals(METHOD)) { + return new VisitVariableVisitor(mv); + } return mv; } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 4eec778dd..2cca2299e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -24,8 +24,7 @@ public class Builder { - private static final Char2CharMap commaSeparatedParts = new Char2CharArrayMap() - { + private static final Char2CharMap commaSeparatedParts = new Char2CharArrayMap() { { put(']', '['); @@ -93,9 +92,11 @@ private static Map> gatherMethods(Class bui if (!method.isAnnotationPresent(RecipeBuilderMethodDescription.class)) continue; RecipeBuilderMethod pair = new RecipeBuilderMethod(method); for (String target : pair.targetFields()) { - if (fields.get(target) != null && fields.get(target).isIgnoringInheritedMethods() && !Arrays.asList(builderClass + if ( + fields.get(target) != null && fields.get(target).isIgnoringInheritedMethods() && !Arrays.asList(builderClass .getDeclaredMethods()) - .contains(method)) { + .contains(method) + ) { continue; } fieldToModifyingMethods.computeIfAbsent(target, k -> new ArrayList<>()).add(pair); @@ -212,7 +213,9 @@ else if (!req.isEmpty() && current == req.get(req.size() - 1)) { req.remove(req.size() - 1); } else if (current == ',' && index > 0) { char nextChar = commaSeparatedParts.get(content.charAt(index - 1)); - if (nextChar != Character.MIN_VALUE && (content.charAt(index + 1) == nextChar || content.charAt(index + 2) == nextChar)) { + if ( + nextChar != Character.MIN_VALUE && (content.charAt(index + 1) == nextChar || content.charAt(index + 2) == nextChar) + ) { int point = content.indexOf(nextChar, index + 1); parts.add(content.substring(start, point)); start = point; @@ -384,9 +387,13 @@ public FieldDocumentation(Field field, List annotations, String langLo this.firstAnnotation = annotations.get(0); } - public Field getField() { return field; } + public Field getField() { + return field; + } - public Property getAnnotation() { return firstAnnotation; } + public Property getAnnotation() { + return firstAnnotation; + } public int priority() { return annotations.stream().map(Property::priority).filter(x -> x != 1000).findFirst().orElse(1000); @@ -439,16 +446,22 @@ public String getRequirement() { .orElse(""); } - public boolean isIgnoringInheritedMethods() { return getAnnotation().ignoresInheritedMethods(); } + public boolean isIgnoringInheritedMethods() { + return getAnnotation().ignoresInheritedMethods(); + } - public boolean isUsed() { return !getAnnotation().needsOverride(); } + public boolean isUsed() { + return !getAnnotation().needsOverride(); + } private String getFieldTypeInlineCode() { //return "`#!groovy " + Exporter.simpleSignature(getField().getAnnotatedType().getType().getTypeName()) + "`. "; return "`" + Exporter.simpleSignature(getField().getAnnotatedType().getType().getTypeName()) + "`. "; } - public String getDescription() { return "- " + getFieldTypeInlineCode() + Documentation.translate(getLangKey()) + "."; } + public String getDescription() { + return "- " + getFieldTypeInlineCode() + Documentation.translate(getLangKey()) + "."; + } @Override public int compareTo(@NotNull FieldDocumentation comp) { @@ -471,9 +484,13 @@ public RecipeBuilderMethod(Method method) { this.annotation = method.getAnnotation(RecipeBuilderMethodDescription.class); } - public Method getMethod() { return method; } + public Method getMethod() { + return method; + } - public RecipeBuilderMethodDescription getAnnotation() { return annotation; } + public RecipeBuilderMethodDescription getAnnotation() { + return annotation; + } public List targetFields() { return getAnnotation().field().length == 0 ? Collections.singletonList(getMethod().getName()) : Arrays.asList( diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 3c59913da..c076ce498 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -77,7 +77,9 @@ public static void generateExamples() { Exporter.generateExamples(stage.getName(), mod); } } - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyScript.LOGGER.throwing(e); } logAnyMissingKeys(); @@ -95,7 +97,9 @@ public static void generateWiki() { GroovyLog.get().error("Error creating file at {} to generate wiki files in", target); } } - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyScript.LOGGER.throwing(e); } logAnyMissingKeys(); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index fe4665422..b6d81cd65 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -66,7 +66,9 @@ public static void generateWiki(File folder, GroovyContainer sortExamples(List examples) { return examples; } - public List getImports() { return this.imports; } + public List getImports() { + return this.imports; + } - public String getFileSourceCodeLink() { return LinkGeneratorHooks.convert(description.linkGenerator(), registryClass); } + public String getFileSourceCodeLink() { + return LinkGeneratorHooks.convert(description.linkGenerator(), registryClass); + } public String getTitle() { return Documentation.translate(description.title().isEmpty() ? String.format("%s.title", baseTranslationKey) : description @@ -274,11 +278,13 @@ public String documentMethods(List methods, boolean preventExamples) { for (Method method : methods) { out.append(methodDescription(method)); - if (method.getAnnotation(MethodDescription.class).example().length > 0 && Arrays.stream(method.getAnnotation( + if ( + method.getAnnotation(MethodDescription.class).example().length > 0 && Arrays.stream(method.getAnnotation( MethodDescription.class) .example()).anyMatch( x -> !x.value() - .isEmpty())) { + .isEmpty()) + ) { exampleLines.addAll(Arrays.stream(method.getAnnotation(MethodDescription.class).example()).flatMap( example -> Stream.of(methodExample(method, example.value()))) diff --git a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java index 818083760..4940ba2ae 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java @@ -114,9 +114,11 @@ public static void playerLogin(PlayerEvent.PlayerLoggedInEvent event) { @SubscribeEvent @SideOnly(Side.CLIENT) public static void onClientChatEvent(ClientChatEvent event) { - if (event.getOriginalMessage().startsWith(CustomClickAction.PREFIX) && CustomClickAction.runActionHook(event + if ( + event.getOriginalMessage().startsWith(CustomClickAction.PREFIX) && CustomClickAction.runActionHook(event .getOriginalMessage() - .substring(CustomClickAction.PREFIX.length()))) { + .substring(CustomClickAction.PREFIX.length())) + ) { event.setCanceled(true); } } @@ -202,17 +204,25 @@ private static boolean isUTRecipeBookEnabled() { try { Class utConfig = Class.forName("mod.acgaming.universaltweaks.config.UTConfigTweaks"); miscField = utConfig.getField("MISC"); - } catch (ClassNotFoundException e) { + } catch ( + ClassNotFoundException e + ) { // try using an older version try { Class utConfig = Class.forName("mod.acgaming.universaltweaks.config.UTConfig"); miscField = utConfig.getField("TWEAKS_MISC"); - } catch (ClassNotFoundException ex) { + } catch ( + ClassNotFoundException ex + ) { return false; - } catch (NoSuchFieldException ex) { + } catch ( + NoSuchFieldException ex + ) { throw new RuntimeException(ex); } - } catch (NoSuchFieldException e) { + } catch ( + NoSuchFieldException e + ) { throw new RuntimeException(e); } @@ -220,7 +230,9 @@ private static boolean isUTRecipeBookEnabled() { Object misc = miscField.get(null); Field bookToggleField = misc.getClass().getField("utRecipeBookToggle"); return !(boolean) bookToggleField.get(misc); - } catch (NoSuchFieldException | IllegalAccessException e) { + } catch ( + NoSuchFieldException | IllegalAccessException e + ) { throw new RuntimeException(e); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/event/ScriptRunEvent.java b/src/main/java/com/cleanroommc/groovyscript/event/ScriptRunEvent.java index f383680cf..096b28ff8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/ScriptRunEvent.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/ScriptRunEvent.java @@ -12,7 +12,9 @@ public ScriptRunEvent(LoadStage loadStage) { this.loadStage = loadStage; } - public LoadStage getLoadStage() { return loadStage; } + public LoadStage getLoadStage() { + return loadStage; + } /** * Called before anything on script run (first load and reload) diff --git a/src/main/java/com/cleanroommc/groovyscript/gameobjects/GameObjectHandlerManager.java b/src/main/java/com/cleanroommc/groovyscript/gameobjects/GameObjectHandlerManager.java index dbfbeb894..0addd559b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/gameobjects/GameObjectHandlerManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/gameobjects/GameObjectHandlerManager.java @@ -38,7 +38,9 @@ public static ObjectMapper getGameObjectHandler(Class containerClass, Stri return ObjectMapperManager.getObjectMapper(containerClass, key); } - public static Collection> getGameObjectHandlers() { return ObjectMapperManager.getObjectMappers(); } + public static Collection> getGameObjectHandlers() { + return ObjectMapperManager.getObjectMappers(); + } public static Class getReturnTypeOf(String name) { return ObjectMapperManager.getReturnTypeOf(name); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ArrayUtils.java b/src/main/java/com/cleanroommc/groovyscript/helper/ArrayUtils.java index 5dfd796f1..b556b5869 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ArrayUtils.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ArrayUtils.java @@ -104,7 +104,9 @@ public static T[][] deepCopy2d(@NotNull T[][] src, @Nullable T[][] dest) { } public static T[] copy1d(@NotNull T[] src, @Nullable T[] dest) { - if (dest == null || dest.length < src.length) { return Arrays.copyOf(src, src.length); } + if (dest == null || dest.length < src.length) { + return Arrays.copyOf(src, src.length); + } System.arraycopy(src, 0, dest, 0, src.length); return dest; } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/BetterList.java b/src/main/java/com/cleanroommc/groovyscript/helper/BetterList.java index eb21e4466..c6616074b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/BetterList.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/BetterList.java @@ -30,9 +30,13 @@ public K pollLast() { return isEmpty() ? null : removeLast(); } - public K getFirst() { return get(0); } + public K getFirst() { + return get(0); + } - public K getLast() { return get(size() - 1); } + public K getLast() { + return get(size() - 1); + } public K peekFirst() { return isEmpty() ? null : get(0); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java index f6f04eb92..f9f7fb619 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java @@ -52,7 +52,9 @@ public GroovyFile(File internal) { try { file = GroovyScript.getMinecraftHome().toPath().resolve(internal.toPath()).toFile().getCanonicalFile(); accessible = isPathAccessible(file.getPath()); - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyLog.get().error("Failed to resolve File('{}')", internal.toPath()); file = INVALID; accessible = false; @@ -85,27 +87,39 @@ public GroovyFile(String... parts) { this(new File(FileUtil.makePath(parts))); } - public boolean isInvalid() { return this.internal == INVALID; } + public boolean isInvalid() { + return this.internal == INVALID; + } - public boolean isAccessible() { return accessible; } + public boolean isAccessible() { + return accessible; + } public void checkAccessible() { - if (isInvalid()) { throw new IllegalStateException("Can't access a file which failed to resolve."); } + if (isInvalid()) { + throw new IllegalStateException("Can't access a file which failed to resolve."); + } if (!this.accessible) { throw new SecurityException("Only files in minecraft home and sub directories can be accessed from scripts! Tried to access " + this.internal.getPath()); } } - public String getPath() { return this.internal.getPath(); } + public String getPath() { + return this.internal.getPath(); + } public boolean exists() { return this.internal.exists(); } - public boolean isFile() { return this.internal.isFile(); } + public boolean isFile() { + return this.internal.isFile(); + } - public boolean isDirectory() { return this.internal.isDirectory(); } + public boolean isDirectory() { + return this.internal.isDirectory(); + } public boolean canRead() { return isAccessible() && this.internal.canRead(); @@ -159,7 +173,9 @@ public boolean mkdirs() { return this.internal.mkdirs(); } - public String getCanonicalPath() { return getPath(); } + public String getCanonicalPath() { + return getPath(); + } public GroovyFile getCanonicalFile() { return this; // is already canonical @@ -175,7 +191,9 @@ public boolean equals(Object obj) { if (obj.getClass() == GroovyFile.class) { return isInvalid() == ((GroovyFile) obj).isInvalid() || this.internal.equals(((GroovyFile) obj).internal); } - if (obj instanceof File file) { return !isInvalid() && this.internal.equals(file); } + if (obj instanceof File file) { + return !isInvalid() && this.internal.equals(file); + } return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java index 566b3823c..3816a411f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java @@ -20,41 +20,73 @@ public static boolean isLoaded(String mod) { return Loader.isModLoaded(mod); } - public static LoadStage getLoadStage() { return GroovyScript.getSandbox().getCurrentLoader(); } + public static LoadStage getLoadStage() { + return GroovyScript.getSandbox().getCurrentLoader(); + } - public static boolean isReloading() { return getLoadStage().isReloadable() && !ReloadableRegistryManager.isFirstLoad(); } + public static boolean isReloading() { + return getLoadStage().isReloadable() && !ReloadableRegistryManager.isFirstLoad(); + } - public static String getMinecraftVersion() { return GroovyScript.MC_VERSION; } + public static String getMinecraftVersion() { + return GroovyScript.MC_VERSION; + } - public static String getGroovyVersion() { return GroovyScript.GROOVY_VERSION; } + public static String getGroovyVersion() { + return GroovyScript.GROOVY_VERSION; + } - public static String getGroovyScriptVersion() { return GroovyScript.VERSION; } + public static String getGroovyScriptVersion() { + return GroovyScript.VERSION; + } - public static String getGrSVersion() { return GroovyScript.VERSION; } + public static String getGrSVersion() { + return GroovyScript.VERSION; + } - public static String getPackName() { return GroovyScript.getRunConfig().getPackName(); } + public static String getPackName() { + return GroovyScript.getRunConfig().getPackName(); + } - public static String getPackId() { return GroovyScript.getRunConfig().getPackId(); } + public static String getPackId() { + return GroovyScript.getRunConfig().getPackId(); + } - public static String getPackVersion() { return GroovyScript.getRunConfig().getVersion(); } + public static String getPackVersion() { + return GroovyScript.getRunConfig().getVersion(); + } - public static boolean isDebug() { return GroovyScript.getRunConfig().isDebug(); } + public static boolean isDebug() { + return GroovyScript.getRunConfig().isDebug(); + } - public static File getConfigDir() { return Loader.instance().getConfigDir(); } + public static File getConfigDir() { + return Loader.instance().getConfigDir(); + } - public static boolean isClient() { return FMLCommonHandler.instance().getEffectiveSide().isClient(); } + public static boolean isClient() { + return FMLCommonHandler.instance().getEffectiveSide().isClient(); + } - public static boolean isServer() { return FMLCommonHandler.instance().getEffectiveSide().isServer(); } + public static boolean isServer() { + return FMLCommonHandler.instance().getEffectiveSide().isServer(); + } - public static boolean isDedicatedServer() { return FMLCommonHandler.instance().getSide().isServer(); } + public static boolean isDedicatedServer() { + return FMLCommonHandler.instance().getSide().isServer(); + } - public static String getPackmode() { return Packmode.getPackmode(); } + public static String getPackmode() { + return Packmode.getPackmode(); + } public static boolean isPackmode(String packmode) { return getPackmode().equalsIgnoreCase(packmode); } - public static String getMinecraftHome() { return GroovyScript.getMinecraftHome().getPath(); } + public static String getMinecraftHome() { + return GroovyScript.getMinecraftHome().getPath(); + } public static GroovyFile file(String path) { return new GroovyFile(path); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/JsonHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/JsonHelper.java index 0e58b8e5f..daca88e38 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/JsonHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/JsonHelper.java @@ -22,7 +22,9 @@ public static float getFloat(JsonObject json, float defaultValue, String... keys for (String key : keys) { if (json.has(key)) { JsonElement jsonElement = json.get(key); - if (jsonElement.isJsonPrimitive()) { return jsonElement.getAsFloat(); } + if (jsonElement.isJsonPrimitive()) { + return jsonElement.getAsFloat(); + } return defaultValue; } } @@ -33,7 +35,9 @@ public static int getInt(JsonObject json, int defaultValue, String... keys) { for (String key : keys) { if (json.has(key)) { JsonElement jsonElement = json.get(key); - if (jsonElement.isJsonPrimitive()) { return jsonElement.getAsInt(); } + if (jsonElement.isJsonPrimitive()) { + return jsonElement.getAsInt(); + } return defaultValue; } } @@ -44,7 +48,9 @@ public static boolean getBoolean(JsonObject json, boolean defaultValue, String.. for (String key : keys) { if (json.has(key)) { JsonElement jsonElement = json.get(key); - if (jsonElement.isJsonPrimitive()) { return jsonElement.getAsBoolean(); } + if (jsonElement.isJsonPrimitive()) { + return jsonElement.getAsBoolean(); + } return defaultValue; } } @@ -55,7 +61,9 @@ public static String getString(JsonObject json, String defaultValue, String... k for (String key : keys) { if (json.has(key)) { JsonElement jsonElement = json.get(key); - if (jsonElement.isJsonPrimitive()) { return jsonElement.getAsString(); } + if (jsonElement.isJsonPrimitive()) { + return jsonElement.getAsString(); + } } } return defaultValue; @@ -65,7 +73,9 @@ public static T getObject(JsonObject json, T defaultValue, Function forEach(Closure closure) { public T findFirst() { T recipe = getFirst(); - if (recipe == null) { throw new NoSuchElementException(); } + if (recipe == null) { + throw new NoSuchElementException(); + } return recipe; } @Nullable public T getFirst() { for (T recipe : this.recipes) { - if (recipe != null) { return recipe; } + if (recipe != null) { + return recipe; + } } return null; } - public List getList() { return new ArrayList<>(this.recipes); } + public List getList() { + return new ArrayList<>(this.recipes); + } - public Set getSet() { return new ObjectOpenHashSet<>(this.recipes); } + public Set getSet() { + return new ObjectOpenHashSet<>(this.recipes); + } @Override public boolean removeIf(Predicate filter) { @@ -102,7 +110,9 @@ public int size() { } @Override - public boolean isEmpty() { return this.recipes.isEmpty(); } + public boolean isEmpty() { + return this.recipes.isEmpty(); + } @Override public T get(int index) { @@ -111,7 +121,9 @@ public T get(int index) { @Override public boolean remove(Object o) { - if (o != null && this.remover == null || this.remover.test((T) o)) { return this.recipes.remove(o); } + if (o != null && this.remover == null || this.remover.test((T) o)) { + return this.recipes.remove(o); + } return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java index 70cd5366b..31064ca47 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java @@ -14,7 +14,9 @@ public FluidStackList(Collection collection) { } public FluidStack getOrEmpty(int i) { - if (i < 0 || i >= size()) { return null; } + if (i < 0 || i >= size()) { + return null; + } return get(i); } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientBase.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientBase.java index 73923146f..7234cc4f0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientBase.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientBase.java @@ -42,7 +42,9 @@ public boolean test(ItemStack itemStack) { @Override public ItemStack applyTransform(ItemStack matchedInput) { - if (transformer != null) { return ClosureHelper.call(ItemStack.EMPTY, transformer, matchedInput); } + if (transformer != null) { + return ClosureHelper.call(ItemStack.EMPTY, transformer, matchedInput); + } return ForgeHooks.getContainerItem(matchedInput); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java index bf534f96f..1b1d14693 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java @@ -17,7 +17,9 @@ public ItemStackList(Collection collection) { } public ItemStack getOrEmpty(int i) { - if (i < 0 || i >= size()) { return ItemStack.EMPTY; } + if (i < 0 || i >= size()) { + return ItemStack.EMPTY; + } ItemStack item = get(i); return item == null ? ItemStack.EMPTY : item; } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemsIngredient.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemsIngredient.java index caef8a9bd..e57411143 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemsIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemsIngredient.java @@ -57,20 +57,28 @@ public ItemStack[] getMatchingStacks() { } @Override - public int getAmount() { return itemStacks.isEmpty() ? 0 : amount; } + public int getAmount() { + return itemStacks.isEmpty() ? 0 : amount; + } @Override - public void setAmount(int amount) { this.amount = Math.max(0, amount); } + public void setAmount(int amount) { + this.amount = Math.max(0, amount); + } @Override public boolean matches(ItemStack itemStack) { for (ItemStack itemStack1 : itemStacks) { - if (OreDictionary.itemMatches(itemStack1, itemStack, false)) { return true; } + if (OreDictionary.itemMatches(itemStack1, itemStack, false)) { + return true; + } } return false; } - public List getItemStacks() { return Collections.unmodifiableList(this.itemStacks); } + public List getItemStacks() { + return Collections.unmodifiableList(this.itemStacks); + } @NotNull @Override public Iterator iterator() { diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/NbtHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/NbtHelper.java index e288c436a..c1f8c4bd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/NbtHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/NbtHelper.java @@ -25,7 +25,9 @@ public static boolean containsNbt(NBTTagCompound nbtContainer, NBTTagCompound nb NBTBase nbt1 = nbtContainer.getTag(key); if (nbt1 == null) return false; NBTBase nbt2 = nbtMatcher.getTag(key); - if (!matches(nbt1, nbt2, true)) { return false; } + if (!matches(nbt1, nbt2, true)) { + return false; + } } return true; } @@ -33,7 +35,9 @@ public static boolean containsNbt(NBTTagCompound nbtContainer, NBTTagCompound nb public static boolean matches(NBTBase nbt1, NBTBase nbt2, boolean contains) { if (!contains) return nbt1.equals(nbt2); if (nbt1.getId() != nbt2.getId()) return false; - if (nbt1.getId() == Constants.NBT.TAG_COMPOUND) { return containsNbt((NBTTagCompound) nbt1, (NBTTagCompound) nbt2); } + if (nbt1.getId() == Constants.NBT.TAG_COMPOUND) { + return containsNbt((NBTTagCompound) nbt1, (NBTTagCompound) nbt2); + } return nbt1.equals(nbt2); } @@ -47,7 +51,9 @@ public static NBTTagCompound ofMap(Map map) { } public static NBTBase toNbt(Object o) { - if (o instanceof Map) { return ofMap((Map) o); } + if (o instanceof Map) { + return ofMap((Map) o); + } if (o instanceof List) { NBTTagList list = new NBTTagList(); byte type = 0; diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OrIngredient.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OrIngredient.java index a7763a4bb..a12b3b8ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OrIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OrIngredient.java @@ -15,10 +15,14 @@ public class OrIngredient extends IngredientBase { private int amount = 1; @Override - public int getAmount() { return amount; } + public int getAmount() { + return amount; + } @Override - public void setAmount(int amount) { this.amount = amount; } + public void setAmount(int amount) { + this.amount = amount; + } @Override public IIngredient exactCopy() { @@ -47,7 +51,9 @@ public ItemStack[] getMatchingStacks() { @Override public boolean matches(ItemStack itemStack) { for (IIngredient ingredient : this.ingredients) { - if (ingredient.test(itemStack)) { return true; } + if (ingredient.test(itemStack)) { + return true; + } } return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java index 68cf9160e..d97e10d30 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java @@ -22,13 +22,19 @@ public OreDictIngredient(String oreDict) { this.oreDict = oreDict; } - public String getOreDict() { return oreDict; } + public String getOreDict() { + return oreDict; + } @Override - public int getAmount() { return count; } + public int getAmount() { + return count; + } @Override - public void setAmount(int amount) { count = Math.max(0, amount); } + public void setAmount(int amount) { + count = Math.max(0, amount); + } @Override public OreDictIngredient exactCopy() { @@ -45,7 +51,9 @@ public boolean matches(ItemStack stack) { if (IngredientHelper.isEmpty(stack)) return false; for (int id : OreDictionary.getOreIDs(stack)) { String oreName = OreDictionary.getOreName(id); - if (oreDict.equals(oreName)) { return true; } + if (oreDict.equals(oreName)) { + return true; + } } return false; } @@ -67,9 +75,13 @@ private List prepareItemStacks() { } @Override - public ItemStack[] getMatchingStacks() { return prepareItemStacks().toArray(new ItemStack[0]); } + public ItemStack[] getMatchingStacks() { + return prepareItemStacks().toArray(new ItemStack[0]); + } - public ItemStack getFirst() { return prepareItemStacks().get(0); } + public ItemStack getFirst() { + return prepareItemStacks().get(0); + } public ItemStack getAt(int index) { return prepareItemStacks().get(index); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictWildcardIngredient.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictWildcardIngredient.java index 17775224f..1f281ca53 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictWildcardIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictWildcardIngredient.java @@ -40,9 +40,13 @@ public OreDictWildcardIngredient(String oreDict, List matchingOreDiction this.matchingOreDictionaries.addAll(matchingOreDictionaries); } - public String getOreDict() { return oreDict; } + public String getOreDict() { + return oreDict; + } - public List getMatchingOreDictionaries() { return ores; } + public List getMatchingOreDictionaries() { + return ores; + } public List getOres() { return this.ores.stream().map(OreDictIngredient::new).collect(Collectors.toList()); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java index 32113701f..ca605eb72 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java @@ -29,7 +29,9 @@ public abstract class AbstractRecipeBuilder implements IRecipeBuilder { @Property(value = "groovyscript.wiki.fluidOutput.value", needsOverride = true, priority = 750, hierarchy = 20) protected final FluidStackList fluidOutput = new FluidStackList(); - public String getRecipeNamePrefix() { return "groovyscript_"; } + public String getRecipeNamePrefix() { + return "groovyscript_"; + } @RecipeBuilderMethodDescription public AbstractRecipeBuilder name(String name) { @@ -197,7 +199,9 @@ public void validateCustom(GroovyLog.Msg msg, Collection collection, int min, } protected static String getRequiredString(int min, int max, String type) { - if (max <= 0) { return "No " + type + "s allowed"; } + if (max <= 0) { + return "No " + type + "s allowed"; + } String out = "Must have "; if (min == max) { out += "exactly " + min + " " + type; diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java index 65e65a74c..701957387 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java @@ -93,19 +93,31 @@ T invokeDefault() { return t == null || t.hasError() ? null : t.getValue(); } - public GroovyContainer getMod() { return mod; } + public GroovyContainer getMod() { + return mod; + } @Override - public Collection getAliases() { return Collections.singleton(this.name); } + public Collection getAliases() { + return Collections.singleton(this.name); + } - public String getName() { return name; } + public String getName() { + return name; + } - public List[]> getParamTypes() { return this.paramTypes; } + public List[]> getParamTypes() { + return this.paramTypes; + } - public Class getReturnType() { return returnType; } + public Class getReturnType() { + return returnType; + } @GroovyBlacklist - public Completer getCompleter() { return completer; } + public Completer getCompleter() { + return completer; + } public T doCall(String s, Object... args) { return invoke(s, args); @@ -116,7 +128,9 @@ public T doCall() { } @Override - public String getDocumentation() { return documentation; } + public String getDocumentation() { + return documentation; + } public List getMethodNodes() { if (methodNodes == null) { diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperManager.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperManager.java index 72593e326..d505af054 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperManager.java @@ -143,7 +143,9 @@ public static void init() { @Nullable public static Object getGameObject(String name, String mainArg, Object... args) { ObjectMapper objectMapper = handlers.get(name); - if (objectMapper != null) { return objectMapper.invoke(mainArg, args); } + if (objectMapper != null) { + return objectMapper.invoke(mainArg, args); + } return null; } @@ -165,7 +167,9 @@ public static ObjectMapper getObjectMapper(Class containerClass, String ke return map != null ? map.get(key) : null; } - public static Collection> getObjectMappers() { return handlers.values(); } + public static Collection> getObjectMappers() { + return handlers.values(); + } public static Class getReturnTypeOf(String name) { ObjectMapper goh = handlers.get(name); diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperMetaMethod.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperMetaMethod.java index b3bed02d3..ce30f7bff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperMetaMethod.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapperMetaMethod.java @@ -22,16 +22,24 @@ public class ObjectMapperMetaMethod extends MetaMethod implements IDocumented { } @Override - public int getModifiers() { return Modifier.PUBLIC; } + public int getModifiers() { + return Modifier.PUBLIC; + } @Override - public String getName() { return this.closure.getName(); } + public String getName() { + return this.closure.getName(); + } @Override - public Class getReturnType() { return this.closure.getReturnType(); } + public Class getReturnType() { + return this.closure.getReturnType(); + } @Override - public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(this.owner); } + public CachedClass getDeclaringClass() { + return ReflectionCache.getCachedClass(this.owner); + } @Override public Object invoke(Object object, Object[] arguments) { @@ -40,5 +48,7 @@ public Object invoke(Object object, Object[] arguments) { } @Override - public String getDocumentation() { return this.closure.getDocumentation(); } + public String getDocumentation() { + return this.closure.getDocumentation(); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java index 06f64de24..2c4f8ea0c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java @@ -68,9 +68,13 @@ public class ObjectMappers { return Result.error("Arguments not valid for bracket handler. Use 'item(String)' or 'item(String, int meta)'"); } String[] parts = mainArg.split(SPLITTER); - if (parts.length < 2) { return Result.error("must contain a ':' to separate mod and path"); } + if (parts.length < 2) { + return Result.error("must contain a ':' to separate mod and path"); + } Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(parts[0], parts[1])); - if (item == null) { return Result.error(); } + if (item == null) { + return Result.error(); + } int meta = 0; if (parts.length > 2) { if (WILDCARD.equals(parts[2])) { @@ -78,11 +82,15 @@ public class ObjectMappers { } else { try { meta = Integer.parseInt(parts[2]); - } catch (NumberFormatException ignored) {} + } catch ( + NumberFormatException ignored + ) {} } } if (args.length == 1) { - if (meta != 0) { return Result.error("Defined meta value twice for item mapper"); } + if (meta != 0) { + return Result.error("Defined meta value twice for item mapper"); + } meta = (int) args[0]; } return Result.some(new ItemStack(item, 1, meta)); @@ -103,12 +111,16 @@ public static Result parseFluidStack(String s, Object... args) { if (args.length == 1 && args[0] instanceof Integer) { try { return Result.some(blockState.getBlock().getStateFromMeta((Integer) args[0])); - } catch (Exception e) { + } catch ( + Exception e + ) { return Result.error("could not get block state from meta"); } } for (Object arg : args) { - if (!(arg instanceof String)) { return Result.error("All arguments must be strings!"); } + if (!(arg instanceof String)) { + return Result.error("All arguments must be strings!"); + } } String[] stringArgs = Arrays.stream(args).map(Object::toString).toArray(String[]::new); return parseBlockStates(blockState, Iterators.forArray(stringArgs)); @@ -118,9 +130,13 @@ public static Result parseFluidStack(String s, Object... args) { public static Result parseBlockState(String arg) { String[] parts = arg.split(SPLITTER); - if (parts.length < 2) { return Result.error("Can't find block for '{}'", arg); } + if (parts.length < 2) { + return Result.error("Can't find block for '{}'", arg); + } Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(parts[0], parts[1])); - if (block == null) { return Result.error("Can't find block for '{}'", arg); } + if (block == null) { + return Result.error("Can't find block for '{}'", arg); + } IBlockState blockState = block.getDefaultState(); if (parts.length > 2) { String[] states = parts[2].split(COMMA); @@ -128,7 +144,11 @@ public static Result parseBlockState(String arg) { try { int meta = Integer.parseInt(states[0]); return Result.some(blockState.getBlock().getStateFromMeta(meta)); - } catch (NumberFormatException ignored) {} catch (Exception e) { + } catch ( + NumberFormatException ignored + ) {} catch ( + Exception e + ) { return Result.error("could not get block state from meta"); } } @@ -161,7 +181,9 @@ private static Result parseBlockStates(IBlockState defaultState, It public static Result parseCreativeTab(String mainArg, Object... args) { for (CreativeTabs tab : CreativeTabs.CREATIVE_TAB_ARRAY) { - if (tab != null && mainArg.equals(((CreativeTabsAccessor) tab).getTabLabel2())) { return Result.some(tab); } + if (tab != null && mainArg.equals(((CreativeTabsAccessor) tab).getTabLabel2())) { + return Result.some(tab); + } } return Result.error(); } @@ -171,7 +193,9 @@ public static Result parseTextFormatting(String mainArg, Object. if (textformat == null) { try { textformat = TextFormatting.fromColorIndex(Integer.parseInt(mainArg)); - } catch (NumberFormatException e) { + } catch ( + NumberFormatException e + ) { return Result.error("argument is not a number and not a valid text formatting name"); } } @@ -189,7 +213,9 @@ public static Result parseBlockMaterial(String mainArg, Object... args Material material = (Material) field.get(null); materials.put(field.getName(), material); materials.put(field.getName().toLowerCase(Locale.ROOT), material); - } catch (IllegalAccessException e) { + } catch ( + IllegalAccessException e + ) { throw new RuntimeException(e); } } @@ -202,7 +228,9 @@ public static Result parseBlockMaterial(String mainArg, Object... args public static @NotNull Result parseNBT(String mainArg, Object... args) { try { return Result.some(JsonToNBT.getTagFromJson(mainArg)); - } catch (NBTException e) { + } catch ( + NBTException e + ) { return Result.error("unable to parse provided nbt string"); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/network/NetworkUtils.java b/src/main/java/com/cleanroommc/groovyscript/network/NetworkUtils.java index 65e319c0e..33ccfc184 100644 --- a/src/main/java/com/cleanroommc/groovyscript/network/NetworkUtils.java +++ b/src/main/java/com/cleanroommc/groovyscript/network/NetworkUtils.java @@ -22,7 +22,9 @@ public class NetworkUtils { public static final Consumer EMPTY_PACKET = buffer -> {}; - public static boolean isDedicatedClient() { return FMLCommonHandler.instance().getSide().isClient(); } + public static boolean isDedicatedClient() { + return FMLCommonHandler.instance().getSide().isClient(); + } public static boolean isClient(EntityPlayer player) { if (player == null) throw new NullPointerException("Can't get side of null player!"); @@ -53,7 +55,9 @@ public static void writeFluidStack(PacketBuffer buffer, @Nullable FluidStack flu @Nullable public static FluidStack readFluidStack(PacketBuffer buffer) throws IOException { - if (buffer.readBoolean()) { return null; } + if (buffer.readBoolean()) { + return null; + } return FluidStack.loadFluidStackFromNBT(buffer.readCompoundTag()); } diff --git a/src/main/java/com/cleanroommc/groovyscript/packmode/Packmode.java b/src/main/java/com/cleanroommc/groovyscript/packmode/Packmode.java index 9fb07b810..b006c11b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/packmode/Packmode.java +++ b/src/main/java/com/cleanroommc/groovyscript/packmode/Packmode.java @@ -22,7 +22,9 @@ public class Packmode { public static String getPackmode() { if (GroovyScript.getRunConfig().isIntegratePackmodeMod()) return PackModeAPI.getInstance().getCurrentPackMode(); if (hasPackmode()) return Packmode.packmode; - if (needsPackmode()) { throw new IllegalStateException("Tried to get packmode which is currently empty!"); } + if (needsPackmode()) { + throw new IllegalStateException("Tried to get packmode which is currently empty!"); + } return StringUtils.EMPTY; } @@ -46,7 +48,9 @@ public static void updatePackmode(String packmode) { } public static boolean isValidPackmode(String mode) { - if (GroovyScript.getRunConfig().isIntegratePackmodeMod()) { return PackModeAPI.getInstance().isValidPackMode(mode); } + if (GroovyScript.getRunConfig().isIntegratePackmodeMod()) { + return PackModeAPI.getInstance().isValidPackMode(mode); + } return GroovyScript.getRunConfig().isValidPackmode(mode); } @@ -58,6 +62,8 @@ public ChangeEvent(String packmode) { this.packmode = packmode; } - public String getPackmode() { return packmode; } + public String getPackmode() { + return packmode; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeButton.java b/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeButton.java index 43078f41d..4cef2932c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeButton.java +++ b/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeButton.java @@ -47,7 +47,11 @@ public void updatePackmode() { } } - public String getPackmode() { return packmode; } + public String getPackmode() { + return packmode; + } - public String getDesc() { return desc; } + public String getDesc() { + return desc; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeSaveData.java b/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeSaveData.java index 940d12c88..ed386613d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeSaveData.java +++ b/src/main/java/com/cleanroommc/groovyscript/packmode/PackmodeSaveData.java @@ -16,7 +16,9 @@ public class PackmodeSaveData extends WorldSavedData { public static final String ID = "groovyscript_packmode"; public static PackmodeSaveData get(World world) { - if (world instanceof WorldServer) { return get(world.getMinecraftServer()); } + if (world instanceof WorldServer) { + return get(world.getMinecraftServer()); + } return null; } @@ -54,14 +56,18 @@ public void readFromNBT(NBTTagCompound nbt) { return compound; } - public boolean isDedicatedServer() { return dedicatedServer; } + public boolean isDedicatedServer() { + return dedicatedServer; + } public void setPackmode(String packmode) { this.packmode = packmode; markDirty(); } - public String getPackmode() { return packmode; } + public String getPackmode() { + return packmode; + } public boolean hasPackmode() { return packmode != null && !packmode.isEmpty(); diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java index 9ce09732b..6577c9ba6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java @@ -55,7 +55,9 @@ public AbstractCraftingRecipeBuilder(int width, int height) { } private static IIngredient getIngredient(Char2ObjectMap keyMap, char c) { - if (keyMap.containsKey(c)) { return keyMap.get(c); } + if (keyMap.containsKey(c)) { + return keyMap.get(c); + } return Crafting.getFallback(c); } @@ -123,7 +125,9 @@ protected void handleReplace() { } @GroovyBlacklist - public String getRecipeNamePrefix() { return "groovyscript_"; } + public String getRecipeNamePrefix() { + return "groovyscript_"; + } @GroovyBlacklist public void validateName() { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java index 9f3055676..559081943 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java @@ -24,10 +24,14 @@ public AbstractReloadableStorage() { } @GroovyBlacklist - public Collection getBackupRecipes() { return Collections.unmodifiableCollection(backup); } + public Collection getBackupRecipes() { + return Collections.unmodifiableCollection(backup); + } @GroovyBlacklist - public Collection getScriptedRecipes() { return Collections.unmodifiableCollection(scripted); } + public Collection getScriptedRecipes() { + return Collections.unmodifiableCollection(scripted); + } @GroovyBlacklist @ApiStatus.Internal private void initBackup() { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/DummyRecipe.java b/src/main/java/com/cleanroommc/groovyscript/registry/DummyRecipe.java index 113c1dba1..9c70f462a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/DummyRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/DummyRecipe.java @@ -26,5 +26,7 @@ public boolean canFit(final int width, final int height) { } @Nonnull @Override - public ItemStack getRecipeOutput() { return ItemStack.EMPTY; } + public ItemStack getRecipeOutput() { + return ItemStack.EMPTY; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java index f94b42f48..eb680cff5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java @@ -28,7 +28,9 @@ public ForgeRegistryWrapper(IForgeRegistry registry, Collection alias } @GroovyBlacklist - public IForgeRegistry getRegistry() { return registry; } + public IForgeRegistry getRegistry() { + return registry; + } @GroovyBlacklist @Override public final void onReload() { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java b/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java index ced059135..0fa155ff1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java @@ -22,15 +22,21 @@ public NamedRegistry() { public NamedRegistry(@Nullable Collection aliases) { Collection local = aliases == null ? Alias.generateOfClass(this) : aliases; - if (local.isEmpty()) { throw new IllegalArgumentException("NamedRegistry must have at least one name!"); } + if (local.isEmpty()) { + throw new IllegalArgumentException("NamedRegistry must have at least one name!"); + } this.aliases = Collections.unmodifiableList(local.stream().distinct().collect(Collectors.toList())); this.name = this.aliases.get(0).toLowerCase(Locale.ENGLISH); } @Override - public String getName() { return name; } + public String getName() { + return name; + } @Override - public List getAliases() { return aliases; } + public List getAliases() { + return aliases; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java b/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java index ee1c48e39..a2403cc4e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java @@ -45,7 +45,9 @@ public class ReloadableRegistryManager { private static final Map, List> recipeRecovery = new Object2ObjectOpenHashMap<>(); private static final Map, List> scriptRecipes = new Object2ObjectOpenHashMap<>(); - public static boolean isFirstLoad() { return firstLoad.get(); } + public static boolean isFirstLoad() { + return firstLoad.get(); + } public static void setLoaded() { firstLoad.set(false); @@ -158,7 +160,9 @@ public static void reloadJei(boolean msgPlayer) { try { //noinspection JavaReflectionMemberAccess IngredientFilter.class.getDeclaredMethod("block").invoke(filter); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ignored) {} + } catch ( + IllegalAccessException | InvocationTargetException | NoSuchMethodException ignored + ) {} } } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedForgeRegistryEntry.java b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedForgeRegistryEntry.java index 6643a49e6..86910e134 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedForgeRegistryEntry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedForgeRegistryEntry.java @@ -16,11 +16,17 @@ public VirtualizedForgeRegistryEntry(T value, int id, Object override) { this.override = override; } - public T getValue() { return value; } + public T getValue() { + return value; + } - public int getId() { return id; } + public int getId() { + return id; + } - public Object getOverride() { return override; } + public Object getOverride() { + return override; + } @Override public boolean equals(Object o) { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java index e7e985038..0d7668441 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java @@ -33,10 +33,14 @@ protected AbstractReloadableStorage createRecipeStorage() { } @GroovyBlacklist - public Collection getBackupRecipes() { return recipeStorage.getBackupRecipes(); } + public Collection getBackupRecipes() { + return recipeStorage.getBackupRecipes(); + } @GroovyBlacklist - public Collection getScriptedRecipes() { return recipeStorage.getScriptedRecipes(); } + public Collection getScriptedRecipes() { + return recipeStorage.getScriptedRecipes(); + } @GroovyBlacklist public void addBackup(R recipe) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/ClosureHelper.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/ClosureHelper.java index ada70af27..460993ea4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/ClosureHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/ClosureHelper.java @@ -25,13 +25,17 @@ public static T call(Closure closure, Object... args) { @Nullable public static T call(Class expectedType, Closure closure, Object... args) { Object o = call(closure, args); - if (o != null && expectedType.isAssignableFrom(o.getClass())) { return (T) o; } + if (o != null && expectedType.isAssignableFrom(o.getClass())) { + return (T) o; + } return null; } public static T call(T defaultValue, Closure closure, Object... args) { Object o = call(closure, args); - if (o != null && o.getClass().isInstance(defaultValue)) { return (T) o; } + if (o != null && o.getClass().isInstance(defaultValue)) { + return (T) o; + } return defaultValue; } @@ -84,15 +88,23 @@ public static Closure getUnderlyingClosure(Object functionalInterface) { break; } } - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + } catch ( + NoSuchMethodException | InvocationTargetException | IllegalAccessException e + ) { throw new RuntimeException(e); } - if (h == null) { throw new IllegalStateException("Field h not found"); } + if (h == null) { + throw new IllegalStateException("Field h not found"); + } } try { InvocationHandler handler = (InvocationHandler) h.get(functionalInterface); - if (handler instanceof ConvertedClosure convertedClosure) { return (Closure) convertedClosure.getDelegate(); } - } catch (IllegalArgumentException | IllegalAccessException e) { + if (handler instanceof ConvertedClosure convertedClosure) { + return (Closure) convertedClosure.getDelegate(); + } + } catch ( + IllegalArgumentException | IllegalAccessException e + ) { GroovyLog.get().exception(e); } return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledClass.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledClass.java index 0b23b5f70..2f2dd0355 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledClass.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledClass.java @@ -43,7 +43,9 @@ public void onCompile(Class clazz, String basePath) { stream.write(this.data); stream.flush(); } - } catch (IOException e) { + } catch ( + IOException e + ) { throw new RuntimeException(e); } } @@ -55,7 +57,9 @@ public boolean readData(String basePath) { try { this.data = Files.readAllBytes(file.toPath()); return true; - } catch (IOException e) { + } catch ( + IOException e + ) { return false; } } @@ -63,7 +67,9 @@ public boolean readData(String basePath) { public void deleteCache(String cachePath) { try { Files.deleteIfExists(getDataFile(cachePath).toPath()); - } catch (IOException e) { + } catch ( + IOException e + ) { throw new RuntimeException(e); } } @@ -72,9 +78,13 @@ protected File getDataFile(String basePath) { return FileUtil.makeFile(basePath, FileUtil.getParent(this.path), this.name + CLASS_SUFFIX); } - public String getName() { return name; } + public String getName() { + return name; + } - public String getPath() { return path; } + public String getPath() { + return path; + } @Override public String toString() { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java index d98f09770..60c28b9f7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java @@ -30,11 +30,15 @@ public CompiledScript(String path, String name, long lastEdited) { this.lastEdited = lastEdited; } - public boolean isClosure() { return lastEdited < 0; } + public boolean isClosure() { + return lastEdited < 0; + } public CompiledClass findInnerClass(String clazz) { for (CompiledClass comp : this.innerClasses) { - if (comp.name.equals(clazz)) { return comp; } + if (comp.name.equals(clazz)) { + return comp; + } } CompiledClass comp = new CompiledClass(this.path, clazz); this.innerClasses.add(comp); diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/FileUtil.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/FileUtil.java index be6862a7b..9f1afa9c2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/FileUtil.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/FileUtil.java @@ -15,7 +15,9 @@ public class FileUtil { public static String relativize(String rootPath, String longerThanRootPath) { try { longerThanRootPath = URLDecoder.decode(longerThanRootPath, "UTF-8"); - } catch (UnsupportedEncodingException ignored) {} + } catch ( + UnsupportedEncodingException ignored + ) {} if (File.separatorChar != '/') { longerThanRootPath = longerThanRootPath.replace('/', File.separatorChar); @@ -55,16 +57,22 @@ public static String sanitizePath(String path) { return path.replace(getOtherSeparatorChar(), File.separatorChar); } - public static char getOtherSeparatorChar() { return File.separatorChar == '/' ? '\\' : '/'; } + public static char getOtherSeparatorChar() { + return File.separatorChar == '/' ? '\\' : '/'; + } public static File makeFile(String... pieces) { return new File(makePath(pieces)); } - public static String getMinecraftHome() { return Loader.instance().getConfigDir().getParent(); } + public static String getMinecraftHome() { + return Loader.instance().getConfigDir().getParent(); + } public static boolean mkdirs(File file) { - if (file.isDirectory()) { return file.mkdirs(); } + if (file.isDirectory()) { + return file.mkdirs(); + } return file.getParentFile().mkdirs(); } @@ -74,7 +82,9 @@ public static boolean mkdirsAndFile(File file) { try { Files.createFile(file.toPath()); return true; - } catch (IOException e) { + } catch ( + IOException e + ) { return false; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java index 62caa3441..b846a8639 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java @@ -55,7 +55,9 @@ private GroovyLogImpl() { // create writer which automatically flushes on write tempWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(logFile.toPath()))), true); - } catch (IOException e) { + } catch ( + IOException e + ) { e.printStackTrace(); tempWriter = new PrintWriter(System.out); } @@ -77,13 +79,19 @@ public List collectErrors() { } @Override - public boolean isDebug() { return GroovyScript.getRunConfig().isDebug(); } + public boolean isDebug() { + return GroovyScript.getRunConfig().isDebug(); + } @Override - public PrintWriter getWriter() { return printWriter; } + public PrintWriter getWriter() { + return printWriter; + } @Override - public Path getLogFilerPath() { return logFilePath; } + public Path getLogFilerPath() { + return logFilePath; + } @Override public void log(GroovyLog.Msg msg) { @@ -128,7 +136,9 @@ public void log(GroovyLog.Msg msg) { } } - public Path getPath() { return logFilePath; } + public Path getPath() { + return logFilePath; + } /** * Logs a info msg to the groovy log AND Minecraft's log @@ -325,7 +335,9 @@ private MsgImpl(String msg, Object... data) { } @Flow(source = "this.level") - public boolean isValid() { return level != null; } + public boolean isValid() { + return level != null; + } @Override public Msg add(String msg, Object... data) { @@ -335,13 +347,17 @@ public Msg add(String msg, Object... data) { @Override public Msg add(boolean condition, String msg, Object... args) { - if (condition) { return add(msg, args); } + if (condition) { + return add(msg, args); + } return this; } @Override public Msg add(boolean condition, Supplier msg) { - if (condition) { return add(msg.get()); } + if (condition) { + return add(msg.get()); + } return this; } @@ -396,16 +412,24 @@ public Msg logToMc(boolean logToMC) { } @Override - public @NotNull String getMainMsg() { return mainMsg; } + public @NotNull String getMainMsg() { + return mainMsg; + } @Override - public @NotNull List getSubMessages() { return messages; } + public @NotNull List getSubMessages() { + return messages; + } @Override - public @Nullable Throwable getException() { return throwable; } + public @Nullable Throwable getException() { + return throwable; + } @Override - public Level getLevel() { return level; } + public Level getLevel() { + return level; + } @Override public boolean shouldLogToMc() { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java index d3913be56..925d20e37 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java @@ -68,7 +68,9 @@ public void registerBinding(INamed named) { protected void registerStaticImports(Class... classes) { Objects.requireNonNull(classes); - if (classes.length == 0) { throw new IllegalArgumentException("Static imports must not be empty!"); } + if (classes.length == 0) { + throw new IllegalArgumentException("Static imports must not be empty!"); + } Collections.addAll(staticImports, classes); } @@ -173,7 +175,9 @@ public T runClosure(Closure closure, Object... args) { T result = null; try { result = closure.call(args); - } catch (Exception e) { + } catch ( + Exception e + ) { GroovyScript.LOGGER.error("Caught an exception trying to run a closure:"); e.printStackTrace(); } finally { @@ -203,22 +207,34 @@ protected void postRun() {} public abstract Collection getScriptFiles(); - public boolean isRunning() { return this.running.get(); } + public boolean isRunning() { + return this.running.get(); + } - public Map getBindings() { return bindings; } + public Map getBindings() { + return bindings; + } - public Set> getStaticImports() { return staticImports; } + public Set> getStaticImports() { + return staticImports; + } - public String getCurrentScript() { return currentScript; } + public String getCurrentScript() { + return currentScript; + } - protected void setCurrentScript(String currentScript) { this.currentScript = currentScript; } + protected void setCurrentScript(String currentScript) { + this.currentScript = currentScript; + } public static String getRelativePath(String source) { try { Path path = Paths.get(new URL(source).toURI()); Path mainPath = new File(GroovyScript.getScriptPath()).toPath(); return mainPath.relativize(path).toString(); - } catch (URISyntaxException | MalformedURLException e) { + } catch ( + URISyntaxException | MalformedURLException e + ) { GroovyScript.LOGGER.error("Error parsing script source '{}'", source); // don't log to GroovyLog here since it will cause a StackOverflow return source; @@ -235,14 +251,18 @@ protected Class loadScriptClass(GroovyScriptEngine engine, File file) { if (scriptClass == null) { scriptClass = tryLoadDynamicFile(engine, file); } - } catch (ResourceException e) { + } catch ( + ResourceException e + ) { // file was added later, causing a ResourceException // try to manually load the file scriptClass = tryLoadDynamicFile(engine, file); } // if the file is still not found something went wrong - } catch (Exception e) { + } catch ( + Exception e + ) { GroovyLog.get().fatalMC("An error occurred while trying to load script class {}", file.toString()); GroovyLog.get().exception(e); } @@ -261,7 +281,9 @@ private Class tryLoadDynamicFile(GroovyScriptEngine engine, File file) throws // found a valid file break; } - } catch (URISyntaxException e) { + } catch ( + URISyntaxException e + ) { e.printStackTrace(); } } @@ -274,7 +296,9 @@ private Class tryLoadDynamicFile(GroovyScriptEngine engine, File file) throws try { // manually load the file as a groovy script clazz = engine.getGroovyClassLoader().parseClass(path.toFile()); - } catch (IOException e) { + } catch ( + IOException e + ) { e.printStackTrace(); } return clazz; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java index 603fee053..440a44cd1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java @@ -140,11 +140,15 @@ public void run(LoadStage currentLoadStage) { this.currentLoadStage = Objects.requireNonNull(currentLoadStage); try { super.load(); - } catch (IOException | ScriptException | ResourceException e) { + } catch ( + IOException | ScriptException | ResourceException e + ) { GroovyLog.get().errorMC( "An exception occurred while trying to run groovy code! This is might be a internal groovy issue."); GroovyLog.get().exception(e); - } catch (Throwable t) { + } catch ( + Throwable t + ) { GroovyLog.get().exception(t); } finally { this.currentLoadStage = null; @@ -171,7 +175,9 @@ public T runClosure(Closure closure, Object... args) { T result = null; try { result = runClosureInternal(closure, args); - } catch (Throwable t) { + } catch ( + Throwable t + ) { this.storedExceptions.computeIfAbsent(Arrays.asList(t.getStackTrace()), k -> { GroovyLog.get().error("An exception occurred while running a closure!"); GroovyLog.get().exception(t); @@ -189,10 +195,14 @@ private static T runClosureInternal(Closure closure, Object[] args) { try { //noinspection unchecked return (T) closure.getMetaClass().invokeMethod(closure, "doCall", args); - } catch (InvokerInvocationException e) { + } catch ( + InvokerInvocationException e + ) { UncheckedThrow.rethrow(e.getCause()); return null; // unreachable statement - } catch (Exception e) { + } catch ( + Exception e + ) { if (e instanceof RuntimeException) { throw e; } else { @@ -215,8 +225,10 @@ public void onCompileClass(SourceUnit su, String path, Class clazz, byte[] co // we need to find the source unit of the compiled class SourceUnit trueSource = su.getAST().getUnit().getScriptSourceLocation(mainClassName(clazz.getName())); String truePath = trueSource == null ? shortPath : FileUtil.relativize(this.scriptRoot.getPath(), trueSource.getName()); - if (shortPath.equals(truePath) && su.getAST().getMainClassName() != null && !su.getAST().getMainClassName().equals(clazz - .getName())) { + if ( + shortPath.equals(truePath) && su.getAST().getMainClassName() != null && !su.getAST().getMainClassName().equals(clazz + .getName()) + ) { inner = true; } @@ -252,7 +264,9 @@ protected Class loadScriptClass(GroovyScriptEngine engine, File file) { long lastModified = file.lastModified(); CompiledScript comp = this.index.get(relativeFile.toString()); - if (ENABLE_CACHE && comp != null && lastModified <= comp.lastEdited && comp.clazz == null && comp.readData(this.cacheRoot.getPath())) { + if ( + ENABLE_CACHE && comp != null && lastModified <= comp.lastEdited && comp.clazz == null && comp.readData(this.cacheRoot.getPath()) + ) { // class is not loaded, but the cached class bytes are still valid if (!comp.checkPreprocessors(this.scriptRoot)) { return GroovyLog.class; // failed preprocessor check @@ -350,11 +364,17 @@ public Collection getScriptFiles() { } @Nullable - public LoadStage getCurrentLoader() { return currentLoadStage; } + public LoadStage getCurrentLoader() { + return currentLoadStage; + } - public ImportCustomizer getImportCustomizer() { return importCustomizer; } + public ImportCustomizer getImportCustomizer() { + return importCustomizer; + } - public File getScriptRoot() { return scriptRoot; } + public File getScriptRoot() { + return scriptRoot; + } @ApiStatus.Internal public boolean deleteScriptCache() { @@ -362,7 +382,9 @@ public boolean deleteScriptCache() { try { FileUtils.cleanDirectory(this.cacheRoot); return true; - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyScript.LOGGER.throwing(e); return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/LoadStage.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/LoadStage.java index d2b8ffc8f..4cf78ff0f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/LoadStage.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/LoadStage.java @@ -28,11 +28,17 @@ public static List getLoadStages() { this.priority = priority; } - public String getName() { return name; } + public String getName() { + return name; + } - public boolean isReloadable() { return reloadable; } + public boolean isReloadable() { + return reloadable; + } - public int getPriority() { return priority; } + public int getPriority() { + return priority; + } @Override public String toString() { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java index fd3cd8184..da39ce1f7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java @@ -54,7 +54,9 @@ public static List parsePreprocessors(File file) { if (line.startsWith("//")) { line = line.substring(2).trim(); if (line.isEmpty()) continue; - } else if (!isComment) { return preprocessors.isEmpty() ? Collections.emptyList() : preprocessors; } + } else if (!isComment) { + return preprocessors.isEmpty() ? Collections.emptyList() : preprocessors; + } if (isComment && line.endsWith("*/")) { isComment = false; } @@ -63,7 +65,9 @@ public static List parsePreprocessors(File file) { preprocessors.add(line); } } - } catch (IOException e) { + } catch ( + IOException e + ) { throw new RuntimeException(e); } return preprocessors.isEmpty() ? Collections.emptyList() : preprocessors; @@ -71,7 +75,9 @@ public static List parsePreprocessors(File file) { public static boolean validatePreprocessor(File file, List preprocessors) { for (String pp : preprocessors) { - if (!processPreprocessor(file, pp)) { return false; } + if (!processPreprocessor(file, pp)) { + return false; + } } return true; } @@ -97,7 +103,9 @@ private static boolean processPreprocessor(File file, String line) { private static boolean checkModsLoaded(File file, String[] mods) { for (String mod : mods) { - if (!Loader.isModLoaded(mod)) { return false; } + if (!Loader.isModLoaded(mod)) { + return false; + } } return true; } @@ -109,8 +117,12 @@ private static boolean checkSide(File file, String[] sides) { return true; } String side = sides[0].toUpperCase(); - if ("CLIENT".equals(side)) { return FMLCommonHandler.instance().getSide().isClient(); } - if ("SERVER".equals(side)) { return FMLCommonHandler.instance().getSide().isServer(); } + if ("CLIENT".equals(side)) { + return FMLCommonHandler.instance().getSide().isClient(); + } + if ("SERVER".equals(side)) { + return FMLCommonHandler.instance().getSide().isServer(); + } GroovyLog.get().error("Side processor argument in file '{}' must be CLIENT or SERVER (lower case is allowed too)", file .getName()); return true; @@ -125,7 +137,9 @@ private static boolean checkPackmode(File file, String[] modes) { GroovyLog.get().error("The packmode '{}' specified in file '{}' does not exist. Valid values are {}", mode, file .getName(), valid); - } else if (Packmode.getPackmode().equals(Alias.autoConvertTo(mode, CaseFormat.LOWER_UNDERSCORE))) { return true; } + } else if (Packmode.getPackmode().equals(Alias.autoConvertTo(mode, CaseFormat.LOWER_UNDERSCORE))) { + return true; + } } return false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java index 22e671295..3957d1425 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java @@ -91,7 +91,9 @@ public static JsonObject createDefaultJson() { public static boolean isGroovyFile(String path) { for (String suffix : GROOVY_SUFFIXES) { - if (path.endsWith(suffix)) { return true; } + if (path.endsWith(suffix)) { + return true; + } } return false; } @@ -115,7 +117,9 @@ public RunConfig(JsonObject json) { @ApiStatus.Internal public void reload(JsonObject json, boolean init) { - if (GroovyScript.isSandboxLoaded() && GroovyScript.getSandbox().isRunning()) { throw new RuntimeException(); } + if (GroovyScript.isSandboxLoaded() && GroovyScript.getSandbox().isRunning()) { + throw new RuntimeException(); + } this.debug = JsonHelper.getBoolean(json, false, "debug"); this.classes.clear(); this.loaderPaths.clear(); @@ -215,7 +219,9 @@ public void reload(JsonObject json, boolean init) { } } - public String getPackName() { return packName; } + public String getPackName() { + return packName; + } public String getPackId() { if (this.invalidPackId && !this.warnedAboutInvalidPackId) { @@ -229,15 +235,25 @@ public String getPackId() { return packId; } - public String getPackOrModId() { return this.invalidPackId ? GroovyScript.ID : this.packId; } + public String getPackOrModId() { + return this.invalidPackId ? GroovyScript.ID : this.packId; + } - public String getPackOrModName() { return this.packName.isEmpty() ? GroovyScript.NAME : this.packName; } + public String getPackOrModName() { + return this.packName.isEmpty() ? GroovyScript.NAME : this.packName; + } - public boolean isValidPackId() { return !invalidPackId; } + public boolean isValidPackId() { + return !invalidPackId; + } - public String getVersion() { return version; } + public String getVersion() { + return version; + } - public boolean isDebug() { return debug; } + public boolean isDebug() { + return debug; + } public boolean isValidPackmode(String packmode) { return this.packmodeSet.contains(packmode); @@ -247,7 +263,9 @@ public boolean arePackmodesConfigured() { return !this.packmodeSet.isEmpty(); } - public List getPackmodeList() { return Collections.unmodifiableList(packmodeList); } + public List getPackmodeList() { + return Collections.unmodifiableList(packmodeList); + } public ResourceLocation makeLoc(String name) { return new ResourceLocation(getPackId(), name); @@ -263,9 +281,13 @@ public void initPackmode() { } } - public boolean isIntegratePackmodeMod() { return integratePackmodeMod; } + public boolean isIntegratePackmodeMod() { + return integratePackmodeMod; + } - public int getPackmodeConfigState() { return packmodeConfigState; } + public int getPackmodeConfigState() { + return packmodeConfigState; + } public boolean isLoaderConfigured(String loader) { List path = this.classes.get(loader); @@ -311,7 +333,9 @@ private Collection getSortedFilesOf(File root, Collection paths) { files.put(file, pathSize); } }); - } catch (IOException e) { + } catch ( + IOException e + ) { throw new RuntimeException(e); } } @@ -325,7 +349,9 @@ private static String sanitizePath(String path) { return path; } - private static String getSeparator() { return File.separatorChar == '\\' ? "\\\\" : File.separator; } + private static String getSeparator() { + return File.separatorChar == '\\' ? "\\\\" : File.separator; + } private static boolean checkValid(GroovyLog.Msg errorMsg, List> paths, String loader, String path) { boolean valid = true; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/ScriptModContainer.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/ScriptModContainer.java index dd8191163..4f9c2eabf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/ScriptModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/ScriptModContainer.java @@ -18,7 +18,9 @@ public ScriptModContainer() { } @Override - public File getSource() { return GroovyScriptCore.source; } + public File getSource() { + return GroovyScriptCore.source; + } @Override public boolean registerBus(EventBus bus, LoadController controller) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ClosureMetaMethod.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ClosureMetaMethod.java index 89b4238e0..869d3fc3a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ClosureMetaMethod.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ClosureMetaMethod.java @@ -23,16 +23,24 @@ public ClosureMetaMethod(Closure closure, String name, Class declaringClas } @Override - public int getModifiers() { return Modifier.PUBLIC; } + public int getModifiers() { + return Modifier.PUBLIC; + } @Override - public String getName() { return name; } + public String getName() { + return name; + } @Override - public Class getReturnType() { return Object.class; } + public Class getReturnType() { + return Object.class; + } @Override - public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(declaringClass); } + public CachedClass getDeclaringClass() { + return ReflectionCache.getCachedClass(declaringClass); + } @Override public Object invoke(Object object, Object[] arguments) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java index a0c487e9b..8e7c61e81 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java @@ -35,7 +35,9 @@ public static ExpandoMetaClass getExpandoClass(MetaClass clazz) { } if (!(clazz instanceof ExpandoMetaClass)) { - if (clazz instanceof DelegatingMetaClass delegatingMetaClass && delegatingMetaClass.getAdaptee() instanceof ExpandoMetaClass emc) { + if ( + clazz instanceof DelegatingMetaClass delegatingMetaClass && delegatingMetaClass.getAdaptee() instanceof ExpandoMetaClass emc + ) { clazz = emc; } else { ExpandoMetaClass emc = new ExpandoMetaClass(clazz.getTheClass(), true, true); @@ -81,7 +83,9 @@ private static boolean isValidProperty(MetaProperty prop) { if (prop instanceof MethodMetaProperty && ((MethodMetaProperty) prop).getMetaMethod() instanceof CachedMethod) { return isValid((CachedMethod) ((MethodMetaProperty) prop).getMetaMethod()); } - if (prop instanceof CachedField) { return isValid((CachedField) prop); } + if (prop instanceof CachedField) { + return isValid((CachedField) prop); + } return false; } @@ -137,18 +141,21 @@ public static void mixinMethod(Class self, String name, Function private static void mixinMethod(ExpandoMetaClass self, CachedMethod method, MixinInMetaClass mixin) { final int mod = method.getModifiers(); - if (!isValid(method)) { return; } + if (!isValid(method)) { + return; + } CachedClass[] paramTypes = method.getParameterTypes(); MetaMethod metaMethod; if (Modifier.isStatic(mod)) { if (paramTypes.length > 0 && paramTypes[0].isAssignableFrom(self.getTheClass())) { // instance method disguised as static method if (paramTypes[0].getTheClass() == self.getTheClass()) metaMethod = new NewInstanceMetaMethod(method); - else metaMethod = new NewInstanceMetaMethod(method) - { + else metaMethod = new NewInstanceMetaMethod(method) { @Override - public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(self.getTheClass()); } + public CachedClass getDeclaringClass() { + return ReflectionCache.getCachedClass(self.getTheClass()); + } }; } else { // true static method @@ -177,7 +184,9 @@ public static void mixinProperty(Class self, String name, Class typ public static void mixinProperty(Class self, String name, Class type, @Nullable Function getter, @Nullable BiConsumer setter, boolean hidden) { if (getter == null && setter == null) return; - if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Name for property must not be empty!"); } + if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Name for property must not be empty!"); + } String upperName = name; if (!Character.isDigit(name.charAt(0))) upperName = BeanUtils.capitalize(name); if (getter == null) { @@ -225,16 +234,24 @@ public NewStaticMetaMethod(CachedClass owner, CachedMethod method) { } @Override - public boolean isStatic() { return true; } + public boolean isStatic() { + return true; + } @Override - public int getModifiers() { return Modifier.PUBLIC; } + public int getModifiers() { + return Modifier.PUBLIC; + } @Override - public CachedClass getDeclaringClass() { return owner; } + public CachedClass getDeclaringClass() { + return owner; + } @Override - public CachedClass getOwnerClass() { return owner; } + public CachedClass getOwnerClass() { + return owner; + } } private static class Property extends MetaBeanProperty implements Hidden { @@ -247,6 +264,8 @@ public Property(String name, Class type, MetaMethod getter, MetaMethod setter, b } @Override - public boolean isHidden() { return hidden; } + public boolean isHidden() { + return hidden; + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Getter.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Getter.java index e50fdeb94..75f3a8391 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Getter.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Getter.java @@ -30,16 +30,24 @@ public Getter(String name, Class returnType, Class owner, Function g } @Override - public int getModifiers() { return Modifier.PUBLIC; } + public int getModifiers() { + return Modifier.PUBLIC; + } @Override - public String getName() { return this.name; } + public String getName() { + return this.name; + } @Override - public Class getReturnType() { return this.returnType; } + public Class getReturnType() { + return this.returnType; + } @Override - public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(this.owner); } + public CachedClass getDeclaringClass() { + return ReflectionCache.getCachedClass(this.owner); + } @Override public Object invoke(Object object, Object[] arguments) { @@ -48,5 +56,7 @@ public Object invoke(Object object, Object[] arguments) { } @Override - public boolean isHidden() { return true; } + public boolean isHidden() { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Setter.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Setter.java index d44aff1bc..3bf6c4c58 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Setter.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/Setter.java @@ -25,16 +25,24 @@ public Setter(String name, Class paramType, Class owner, BiConsumer } @Override - public int getModifiers() { return Modifier.PUBLIC; } + public int getModifiers() { + return Modifier.PUBLIC; + } @Override - public String getName() { return this.name; } + public String getName() { + return this.name; + } @Override - public Class getReturnType() { return void.class; } + public Class getReturnType() { + return void.class; + } @Override - public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(this.owner); } + public CachedClass getDeclaringClass() { + return ReflectionCache.getCachedClass(this.owner); + } @Override public Object invoke(Object object, Object[] arguments) { @@ -45,5 +53,7 @@ public Object invoke(Object object, Object[] arguments) { } @Override - public boolean isHidden() { return true; } + public boolean isHidden() { + return true; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/GroovyDeobfMapper.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/GroovyDeobfMapper.java index fda7d7fae..f271c1d1f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/GroovyDeobfMapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/GroovyDeobfMapper.java @@ -96,7 +96,9 @@ public static void init() { } } GroovyScript.LOGGER.info("Read {} field and {} method mapping names", DEOBF_FIELDS.size(), DEOBF_METHODS.size()); - } catch (Exception e) { + } catch ( + Exception e + ) { e.printStackTrace(); } } @@ -180,11 +182,15 @@ public void registerOverloadedMethod(String obfName, String args) { } public String findMethod(Parameter[] args) { - if (this.obfNames == null) { return this.defObfName; } + if (this.obfNames == null) { + return this.defObfName; + } List results = this.obfNames.stream().filter(pair -> pair.getKey().length == args.length).filter(pair -> { for (int i = 0; i < args.length; i++) { String origParam = pair.getKey()[i]; - if (!matches(origParam, args[i])) { return false; } + if (!matches(origParam, args[i])) { + return false; + } } return true; }).map(Pair::getValue).collect(Collectors.toList()); @@ -195,11 +201,15 @@ public String findMethod(Parameter[] args) { } public static boolean matches(String original, Parameter param) { - if (original.equals(Object.class.getName())) { return true; } + if (original.equals(Object.class.getName())) { + return true; + } ClassNode possibleMatch = param.getOriginType(); while (possibleMatch != null) { - if (original.equals(possibleMatch.getName())) { return true; } + if (original.equals(possibleMatch.getName())) { + return true; + } possibleMatch = possibleMatch.getSuperClass(); } return false; @@ -234,7 +244,9 @@ private static String[] makeClassArray(String descriptor) { classes.add(className); } } - } catch (Exception e) { + } catch ( + Exception e + ) { GroovyScript.LOGGER.info("An exception occured while creating a class array of arguments for {}", descriptor); e.printStackTrace(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedField.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedField.java index cf6bb9ae2..836a9b135 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedField.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedField.java @@ -14,5 +14,7 @@ public RemappedCachedField(Field field, String deobfName) { } @Override - public String getName() { return deobfName; } + public String getName() { + return deobfName; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedMethod.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedMethod.java index 73058e66d..c698b3758 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedMethod.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/mapper/RemappedCachedMethod.java @@ -15,5 +15,7 @@ public RemappedCachedMethod(CachedClass clazz, Method method, String deobfName) } @Override - public String getName() { return deobfName; } + public String getName() { + return deobfName; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/BlackListedMetaClass.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/BlackListedMetaClass.java index 6c55de2b2..598f1f383 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/BlackListedMetaClass.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/BlackListedMetaClass.java @@ -70,10 +70,14 @@ public void setAttribute(Class sender, Object receiver, String messageName, Obje public void initialize() {} @Override - public List getProperties() { return Collections.emptyList(); } + public List getProperties() { + return Collections.emptyList(); + } @Override - public List getMethods() { return Collections.emptyList(); } + public List getMethods() { + return Collections.emptyList(); + } @Override public List respondsTo(Object obj, String name, Object[] argTypes) { @@ -106,7 +110,9 @@ public MetaMethod getMetaMethod(String name, Object[] args) { } @Override - public Class getTheClass() { return theClass; } + public Class getTheClass() { + return theClass; + } @Override public Object invokeConstructor(Object[] arguments) { @@ -190,7 +196,9 @@ public ClassNode getClassNode() { unit.setClassgenCallback(search); unit.addSource(url); unit.compile(Phases.CLASS_GENERATION); - } catch (Exception e) { + } catch ( + Exception e + ) { throw new GroovyRuntimeException("Exception thrown parsing: " + groovyFile + ". Reason: " + e, e); } } @@ -200,7 +208,9 @@ public ClassNode getClassNode() { } @Override - public List getMetaMethods() { return Collections.emptyList(); } + public List getMetaMethods() { + return Collections.emptyList(); + } @Override public int selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GrSMetaClassCreationHandle.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GrSMetaClassCreationHandle.java index cd145d98e..3c9887097 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GrSMetaClassCreationHandle.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GrSMetaClassCreationHandle.java @@ -14,7 +14,9 @@ private GrSMetaClassCreationHandle() {} @Override protected MetaClass createNormalMetaClass(Class theClass, MetaClassRegistry registry) { - if (!GroovySecurityManager.INSTANCE.isValid(theClass)) { return new BlackListedMetaClass(theClass); } + if (!GroovySecurityManager.INSTANCE.isValid(theClass)) { + return new BlackListedMetaClass(theClass); + } return super.createNormalMetaClass(theClass, registry); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java index 62058d753..d5e96a16d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java @@ -126,7 +126,9 @@ public boolean isValid(Class clazz) { public boolean isValidPackage(Class clazz) { String className = clazz.getName(); for (String bannedPackage : bannedPackages) { - if (className.startsWith(bannedPackage)) { return false; } + if (className.startsWith(bannedPackage)) { + return false; + } } return true; } @@ -140,11 +142,19 @@ public boolean isValidMethod(Class receiver, String method) { return methods == null || !methods.contains(method); } - public List getBannedPackages() { return Collections.unmodifiableList(bannedPackages); } + public List getBannedPackages() { + return Collections.unmodifiableList(bannedPackages); + } - public Set> getBannedClasses() { return Collections.unmodifiableSet(bannedClasses); } + public Set> getBannedClasses() { + return Collections.unmodifiableSet(bannedClasses); + } - public Map, Set> getBannedMethods() { return Collections.unmodifiableMap(bannedMethods); } + public Map, Set> getBannedMethods() { + return Collections.unmodifiableMap(bannedMethods); + } - public Set> getWhiteListedClasses() { return Collections.unmodifiableSet(whiteListedClasses); } + public Set> getWhiteListedClasses() { + return Collections.unmodifiableSet(whiteListedClasses); + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/AsmDecompileHelper.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/AsmDecompileHelper.java index 9a9894604..61083b5f1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/AsmDecompileHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/AsmDecompileHelper.java @@ -58,7 +58,9 @@ public static ClassStub getDecompiledClass(groovyjarjarasm.asm.ClassVisitor clas public static byte[] transform(String className, byte[] bytes) { for (String s : transformerExceptions) { - if (className.startsWith(s)) { return bytes; } + if (className.startsWith(s)) { + return bytes; + } } String untransformed = FMLDeobfuscatingRemapper.INSTANCE.unmap(className.replace('.', '/')).replace('/', '.'); String transformed = FMLDeobfuscatingRemapper.INSTANCE.map(className.replace('.', '/')).replace('/', '.'); @@ -69,7 +71,9 @@ public static byte[] transform(String className, byte[] bytes) { } public static boolean remove(List anns, String side) { - if (anns == null) { return false; } + if (anns == null) { + return false; + } for (AnnotationNode ann : anns) { if (ann.desc.equals(Type.getDescriptor(SideOnly.class))) { if (ann.values != null) { @@ -78,7 +82,9 @@ public static boolean remove(List anns, String side) { Object value = ann.values.get(x + 1); if (key instanceof String && key.equals("value")) { if (value instanceof String[]) { - if (!((String[]) value)[1].equals(side)) { return true; } + if (!((String[]) value)[1].equals(side)) { + return true; + } } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java index 205ce1070..fc4b683ae 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java @@ -61,7 +61,9 @@ public static PrivilegedAction makeMethodsHook(CachedClass cache .map(!FMLLaunchHandler.isDeobfuscatedEnvironment() && cachedClass.getName().startsWith(MC_CLASS) ? m -> makeMethod(cachedClass, m) : m -> new CachedMethod(cachedClass, m)).toArray( CachedMethod[]::new); - } catch (LinkageError e) { + } catch ( + LinkageError e + ) { return CachedMethod.EMPTY_ARRAY; } }; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptCompiler.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptCompiler.java index 080aa0895..959eebedf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptCompiler.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptCompiler.java @@ -44,8 +44,10 @@ private static boolean isBannedFromSide(AnnotatedNode node) { if (annotatedNode.getClassNode().getName().equals(SIDE_ONLY_CLASS)) { Expression expr = annotatedNode.getMember("value"); if (expr instanceof PropertyExpression prop) { - if (prop.getObjectExpression() instanceof ClassExpression && prop.getObjectExpression().getType().getName() - .equals(SIDE_CLASS)) { + if ( + prop.getObjectExpression() instanceof ClassExpression && prop.getObjectExpression().getType().getName() + .equals(SIDE_CLASS) + ) { String elementSide = prop.getPropertyAsString(); return elementSide != null && !elementSide.equals(AsmDecompileHelper.SIDE); } @@ -64,7 +66,9 @@ public void forbidIfFinalizer(MethodNode m) { break; } } - if (!safe) { throw new SecurityException("Sandboxed code may not override Object.finalize()"); } + if (!safe) { + throw new SecurityException("Sandboxed code may not override Object.finalize()"); + } } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java index 7d192bf47..55f336507 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java @@ -31,7 +31,9 @@ public GroovyScriptTransformer(SourceUnit source, ClassNode classNode) { } @Override - protected SourceUnit getSourceUnit() { return source; } + protected SourceUnit getSourceUnit() { + return source; + } private static Expression makeCheckedCall(ClassNode classNode, String name, List arguments) { return new StaticMethodCallExpression(classNode, name, new ArgumentListExpression(arguments)); @@ -64,8 +66,12 @@ public Expression transform(Expression expr) { } private Expression transformInternal(Expression expr) { - if (expr instanceof ClosureExpression ce) { return transformClosure(ce); } - if (expr instanceof MethodCallExpression mce) { return transformMethodCall(mce); } + if (expr instanceof ClosureExpression ce) { + return transformClosure(ce); + } + if (expr instanceof MethodCallExpression mce) { + return transformMethodCall(mce); + } if (expr instanceof ConstructorCallExpression cce) { if (cce.getType().getName().equals(File.class.getName())) { // redirect to file wrapper diff --git a/src/main/java/com/cleanroommc/groovyscript/server/Completions.java b/src/main/java/com/cleanroommc/groovyscript/server/Completions.java index 06abcb3e2..cd5798126 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/Completions.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/Completions.java @@ -16,7 +16,9 @@ public Completions(int limit) { this.limit = limit; } - public int getLimit() { return limit; } + public int getLimit() { + return limit; + } public boolean reachedLimit() { return size() >= this.limit; diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java index bffe933f3..3e605ce64 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java @@ -34,7 +34,9 @@ public GroovyScriptCompilationUnitFactory(File root, GroovyScriptLanguageServerC } @Override - protected GroovyClassLoader getClassLoader() { return new GroovyClassLoader(Launch.classLoader, config, true); } + protected GroovyClassLoader getClassLoader() { + return new GroovyClassLoader(Launch.classLoader, config, true); + } @Override protected CompilerConfiguration getConfiguration() { diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java index c229ba342..2ade8b91e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java @@ -24,8 +24,10 @@ public class GroovyScriptDocumentationProvider implements IDocumentationProvider public @Nullable String getDocumentation(AnnotatedNode node, ASTContext context) { var builder = new StringBuilder(); - if (node instanceof MethodNode methodNode && methodNode.getDeclaringClass().implementsInterface(new ClassNode( - IScriptReloadable.class))) { + if ( + node instanceof MethodNode methodNode && methodNode.getDeclaringClass().implementsInterface(new ClassNode( + IScriptReloadable.class)) + ) { ModSupport.getAllContainers().stream().filter(IGroovyContainer::isLoaded).map(groovyContainer -> { var methodRegistry = groovyContainer.get().getRegistries().stream().filter(registry -> registry.getClass().equals( methodNode.getDeclaringClass() diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServer.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServer.java index c403f5069..80f322a3d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServer.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServer.java @@ -30,7 +30,9 @@ public static void listen(File root) { server.connect(launcher.getRemoteProxy()); launcher.startListening().get(); - } catch (Exception e) { + } catch ( + Exception e + ) { GroovyScript.LOGGER.error("Connection failed", e); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServerContext.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServerContext.java index a55fa0492..db1df355b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServerContext.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptLanguageServerContext.java @@ -33,13 +33,21 @@ public class GroovyScriptLanguageServerContext implements ILanguageServerContext private final DocumentationFactory documentationFactory = new DocumentationFactory(new GroovyScriptDocumentationProvider(), new GroovydocProvider()); - public GroovyScriptSandbox getSandbox() { return GroovyScript.getSandbox(); } + public GroovyScriptSandbox getSandbox() { + return GroovyScript.getSandbox(); + } - public ScanResult getScanResult() { return this.scanResult; } + public ScanResult getScanResult() { + return this.scanResult; + } @Override - public FileContentsTracker getFileContentsTracker() { return fileContentsTracker; } + public FileContentsTracker getFileContentsTracker() { + return fileContentsTracker; + } @Override - public DocumentationFactory getDocumentationFactory() { return documentationFactory; } + public DocumentationFactory getDocumentationFactory() { + return documentationFactory; + } } diff --git a/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java b/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java index 5b4e5e43a..607fad417 100644 --- a/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java +++ b/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java @@ -82,10 +82,14 @@ public CompletableFuture shutdown() { public void exit() {} @Override - public TextDocumentService getTextDocumentService() { return groovyServices; } + public TextDocumentService getTextDocumentService() { + return groovyServices; + } @Override - public WorkspaceService getWorkspaceService() { return groovyServices; } + public WorkspaceService getWorkspaceService() { + return groovyServices; + } @Override public void setTrace(SetTraceParams params) { diff --git a/src/main/java/net/prominic/groovyls/GroovyServices.java b/src/main/java/net/prominic/groovyls/GroovyServices.java index a0aefb721..9929b5ef7 100644 --- a/src/main/java/net/prominic/groovyls/GroovyServices.java +++ b/src/main/java/net/prominic/groovyls/GroovyServices.java @@ -133,7 +133,9 @@ public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) { @Override public void didChangeConfiguration(DidChangeConfigurationParams params) { - if (!(params.getSettings() instanceof JsonObject)) { return; } + if (!(params.getSettings() instanceof JsonObject)) { + return; + } JsonObject settings = (JsonObject) params.getSettings(); this.updateClasspath(settings); } @@ -165,7 +167,9 @@ public CompletableFuture hover(HoverParams params) { var visitor = compileAndVisitAST(unit, uri); - if (visitor == null) { return CompletableFuture.completedFuture(null); } + if (visitor == null) { + return CompletableFuture.completedFuture(null); + } HoverProvider provider = new HoverProvider(new ASTContext(visitor, languageServerContext)); return provider.provideHover(params.getTextDocument(), params.getPosition()); @@ -338,7 +342,9 @@ public CompletableFuture rename(RenameParams params) { private @Nullable ASTNodeVisitor compileAndVisitAST(GroovyLSCompilationUnit compilationUnit, URI context) { try { return compilationUnit.recompileAndVisitASTIfContextChanged(context); - } catch (GroovyBugError | Exception e) { + } catch ( + GroovyBugError | Exception e + ) { GroovyScript.LOGGER.error("Unexpected exception in language server when compiling Groovy.", e); } finally { Set diagnostics = handleErrorCollector(compilationUnit.getErrorCollector()); diff --git a/src/main/java/net/prominic/groovyls/compiler/ast/ASTContext.java b/src/main/java/net/prominic/groovyls/compiler/ast/ASTContext.java index 965f83297..e973cb5c4 100644 --- a/src/main/java/net/prominic/groovyls/compiler/ast/ASTContext.java +++ b/src/main/java/net/prominic/groovyls/compiler/ast/ASTContext.java @@ -12,7 +12,11 @@ public ASTContext(ASTNodeVisitor astVisitor, ILanguageServerContext languageServ this.languageServerContext = languageServerContext; } - public ASTNodeVisitor getVisitor() { return astVisitor; } + public ASTNodeVisitor getVisitor() { + return astVisitor; + } - public ILanguageServerContext getLanguageServerContext() { return languageServerContext; } + public ILanguageServerContext getLanguageServerContext() { + return languageServerContext; + } } diff --git a/src/main/java/net/prominic/groovyls/compiler/ast/ASTNodeVisitor.java b/src/main/java/net/prominic/groovyls/compiler/ast/ASTNodeVisitor.java index 841bde0c6..227e8fa10 100644 --- a/src/main/java/net/prominic/groovyls/compiler/ast/ASTNodeVisitor.java +++ b/src/main/java/net/prominic/groovyls/compiler/ast/ASTNodeVisitor.java @@ -72,7 +72,9 @@ private static class ASTNodeLookupData { private SourceUnit sourceUnit; @Override - protected SourceUnit getSourceUnit() { return sourceUnit; } + protected SourceUnit getSourceUnit() { + return sourceUnit; + } private final BetterList stack = new BetterList<>(); private final Map> nodesByURI = new Object2ObjectOpenHashMap<>(); @@ -114,7 +116,9 @@ public List getNodes() { public List getNodes(URI uri) { List nodes = nodesByURI.get(uri); - if (nodes == null) { return Collections.emptyList(); } + if (nodes == null) { + return Collections.emptyList(); + } return nodes; } @@ -122,7 +126,9 @@ public ASTNode getNodeAtLineAndColumn(URI uri, int line, int column) { Position position = new Position(line, column); Map nodeToRange = new HashMap<>(); List nodes = nodesByURI.get(uri); - if (nodes == null) { return null; } + if (nodes == null) { + return null; + } List foundNodes = nodes.stream().filter(node -> { if (node.getLineNumber() == -1) { // can't be the offset node if it has no position @@ -130,7 +136,9 @@ public ASTNode getNodeAtLineAndColumn(URI uri, int line, int column) { return false; } Range range = GroovyLanguageServerUtils.astNodeToRange(node); - if (range == null) { return false; } + if (range == null) { + return false; + } boolean result = Ranges.contains(range, position); if (result) { // save the range object to avoid creating it again when we @@ -140,34 +148,50 @@ public ASTNode getNodeAtLineAndColumn(URI uri, int line, int column) { return result; }).sorted((n1, n2) -> { int result = Positions.COMPARATOR.reversed().compare(nodeToRange.get(n1).getStart(), nodeToRange.get(n2).getStart()); - if (result != 0) { return result; } + if (result != 0) { + return result; + } result = Positions.COMPARATOR.compare(nodeToRange.get(n1).getEnd(), nodeToRange.get(n2).getEnd()); - if (result != 0) { return result; } + if (result != 0) { + return result; + } // n1 and n2 have the same range if (contains(n1, n2)) { - if (n1 instanceof ClassNode && n2 instanceof ConstructorNode) { return -1; } + if (n1 instanceof ClassNode && n2 instanceof ConstructorNode) { + return -1; + } return 1; } else if (contains(n2, n1)) { - if (n2 instanceof ClassNode && n1 instanceof ConstructorNode) { return 1; } + if (n2 instanceof ClassNode && n1 instanceof ConstructorNode) { + return 1; + } return -1; } return 0; }).collect(Collectors.toList()); - if (foundNodes.isEmpty()) { return null; } + if (foundNodes.isEmpty()) { + return null; + } return foundNodes.get(0); } public ASTNode getParent(ASTNode child) { - if (child == null) { return null; } + if (child == null) { + return null; + } ASTNodeLookupData data = lookup.get(new ASTLookupKey(child)); - if (data == null) { return null; } + if (data == null) { + return null; + } return data.parent; } public boolean contains(ASTNode ancestor, ASTNode descendant) { ASTNode current = getParent(descendant); while (current != null) { - if (current.equals(ancestor)) { return true; } + if (current.equals(ancestor)) { + return true; + } current = getParent(current); } return false; @@ -175,7 +199,9 @@ public boolean contains(ASTNode ancestor, ASTNode descendant) { public URI getURI(ASTNode node) { ASTNodeLookupData data = lookup.get(new ASTLookupKey(node)); - if (data == null) { return null; } + if (data == null) { + return null; + } return data.uri; } @@ -199,7 +225,9 @@ public void visitCompilationUnit(CompilationUnit unit, Collection uris) { }); unit.iterator().forEachRemaining(sourceUnit -> { URI uri = sourceUnit.getSource().getURI(); - if (!uris.contains(uri)) { return; } + if (!uris.contains(uri)) { + return; + } visitSourceUnit(sourceUnit); }); } diff --git a/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java b/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java index 25afa4507..b5401ee50 100644 --- a/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java +++ b/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java @@ -54,7 +54,9 @@ public GroovyLSCompilationUnit(CompilerConfiguration config, CodeSource security this.errorCollector = new LanguageServerErrorCollector(config); } - public void setErrorCollector(LanguageServerErrorCollector errorCollector) { this.errorCollector = errorCollector; } + public void setErrorCollector(LanguageServerErrorCollector errorCollector) { + this.errorCollector = errorCollector; + } public void removeSources(Collection sourceUnitsToRemove) { for (SourceUnit sourceUnit : sourceUnitsToRemove) { @@ -90,7 +92,9 @@ public void compile() throws CompilationFailedException { // http://groovy-lang.org/metaprogramming.html#_compilation_phases_guide try { compile(Phases.CANONICALIZATION); - } catch (CompilationFailedException e) { + } catch ( + CompilationFailedException e + ) { // ignore } } @@ -114,7 +118,9 @@ private ASTNodeVisitor compileAndVisitAST() { } private ASTNodeVisitor compileAndVisitAST(@Nullable URI context) { - if (context == null) { return compileAndVisitAST(); } + if (context == null) { + return compileAndVisitAST(); + } previousContext = context; @@ -127,7 +133,9 @@ public ASTNodeVisitor recompileAndVisitASTIfContextChanged(@Nullable URI context languageServerContext.getFileContentsTracker().resetChangedFiles(); - if ((previousContext == null || previousContext.equals(context)) && visitor != null && !isChanged) { return visitor; } + if ((previousContext == null || previousContext.equals(context)) && visitor != null && !isChanged) { + return visitor; + } if (context != null) { languageServerContext.getFileContentsTracker().forceChanged(context); diff --git a/src/main/java/net/prominic/groovyls/compiler/control/io/StringReaderSourceWithURI.java b/src/main/java/net/prominic/groovyls/compiler/control/io/StringReaderSourceWithURI.java index 2963b5307..d2022023f 100644 --- a/src/main/java/net/prominic/groovyls/compiler/control/io/StringReaderSourceWithURI.java +++ b/src/main/java/net/prominic/groovyls/compiler/control/io/StringReaderSourceWithURI.java @@ -33,5 +33,7 @@ public StringReaderSourceWithURI(String string, URI uri, CompilerConfiguration c this.uri = uri; } - public URI getURI() { return uri; } + public URI getURI() { + return uri; + } } diff --git a/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java b/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java index 4661b876c..6ea6e5326 100644 --- a/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java +++ b/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java @@ -16,7 +16,9 @@ public DocumentationFactory(IDocumentationProvider... providers) { public @Nullable String getDocumentation(AnnotatedNode node, ASTContext context) { for (IDocumentationProvider provider : providers) { String documentation = provider.getDocumentation(node, context); - if (documentation != null) { return documentation; } + if (documentation != null) { + return documentation; + } } return null; } diff --git a/src/main/java/net/prominic/groovyls/compiler/documentation/GroovydocProvider.java b/src/main/java/net/prominic/groovyls/compiler/documentation/GroovydocProvider.java index bbe599b70..7edb8b773 100644 --- a/src/main/java/net/prominic/groovyls/compiler/documentation/GroovydocProvider.java +++ b/src/main/java/net/prominic/groovyls/compiler/documentation/GroovydocProvider.java @@ -15,7 +15,9 @@ public class GroovydocProvider implements IDocumentationProvider { public @Nullable String getDocumentation(AnnotatedNode node, ASTContext context) { var groovydoc = node.getGroovydoc(); - if (groovydoc == null || !groovydoc.isPresent()) { return null; } + if (groovydoc == null || !groovydoc.isPresent()) { + return null; + } String content = groovydoc.getContent(); String[] lines = content.split("\n"); StringBuilder markdownBuilder = new StringBuilder(); @@ -69,7 +71,9 @@ public class GroovydocProvider implements IDocumentationProvider { private static void appendLine(StringBuilder markdownBuilder, String line) { line = reformatLine(line); - if (line.length() == 0) { return; } + if (line.length() == 0) { + return; + } markdownBuilder.append(line); markdownBuilder.append("\n"); } diff --git a/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java b/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java index 391db783e..acb6766ed 100644 --- a/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java +++ b/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java @@ -56,14 +56,18 @@ public class GroovyASTUtils { public static ASTNode getEnclosingNodeOfType(ASTNode offsetNode, Class nodeType, ASTContext context) { ASTNode current = offsetNode; while (current != null) { - if (nodeType.isInstance(current)) { return current; } + if (nodeType.isInstance(current)) { + return current; + } current = context.getVisitor().getParent(current); } return null; } public static ASTNode getDefinition(ASTNode node, boolean strict, ASTContext context) { - if (node == null) { return null; } + if (node == null) { + return null; + } ASTNode parentNode = context.getVisitor().getParent(node); if (node instanceof ExpressionStatement) { ExpressionStatement statement = (ExpressionStatement) node; @@ -95,13 +99,17 @@ public static ASTNode getDefinition(ASTNode node, boolean strict, ASTContext con } else if (parentNode instanceof PropertyExpression) { PropertyExpression propertyExpression = (PropertyExpression) parentNode; PropertyNode propNode = GroovyASTUtils.getPropertyFromExpression(propertyExpression, context); - if (propNode != null) { return propNode; } + if (propNode != null) { + return propNode; + } return GroovyASTUtils.getFieldFromExpression(propertyExpression, context); } } else if (node instanceof VariableExpression) { VariableExpression variableExpression = (VariableExpression) node; Variable accessedVariable = variableExpression.getAccessedVariable(); - if (accessedVariable instanceof ASTNode) { return (ASTNode) accessedVariable; } + if (accessedVariable instanceof ASTNode) { + return (ASTNode) accessedVariable; + } Object binding = context.getLanguageServerContext().getSandbox().getBindings().get(variableExpression.getName()); if (binding == null) { @@ -122,7 +130,9 @@ public static ASTNode getDefinition(ASTNode node, boolean strict, ASTContext con public static ASTNode getTypeDefinition(ASTNode node, ASTContext context) { ASTNode definitionNode = getDefinition(node, false, context); - if (definitionNode == null) { return null; } + if (definitionNode == null) { + return null; + } if (definitionNode instanceof MethodNode) { MethodNode method = (MethodNode) definitionNode; return tryToResolveOriginalClassNode(method.getReturnType(), true, context); @@ -135,7 +145,9 @@ public static ASTNode getTypeDefinition(ASTNode node, ASTContext context) { public static List getReferences(ASTNode node, ASTContext context) { ASTNode definitionNode = getDefinition(node, true, context); - if (definitionNode == null) { return Collections.emptyList(); } + if (definitionNode == null) { + return Collections.emptyList(); + } return context.getVisitor().getNodes().stream().filter(otherNode -> { ASTNode otherDefinition = getDefinition(otherNode, false, context); return definitionNode.equals(otherDefinition) && node.getLineNumber() != -1 && node.getColumnNumber() != -1; @@ -144,9 +156,13 @@ public static List getReferences(ASTNode node, ASTContext context) { private static ClassNode tryToResolveOriginalClassNode(ClassNode node, boolean strict, ASTContext context) { for (ClassNode originalNode : context.getVisitor().getClassNodes()) { - if (originalNode.equals(node)) { return originalNode; } + if (originalNode.equals(node)) { + return originalNode; + } + } + if (strict) { + return null; } - if (strict) { return null; } return node; } @@ -173,9 +189,13 @@ public static Object resolveDynamicValue(ASTNode node, ASTContext context) { if (value != null) { try { result = value.getClass().getDeclaredField(propertyExpression.getProperty().getText()).get(value); - } catch (IllegalAccessException e) { + } catch ( + IllegalAccessException e + ) { throw new RuntimeException(e); - } catch (NoSuchFieldException e) { + } catch ( + NoSuchFieldException e + ) { return null; } } @@ -189,7 +209,9 @@ public static Object resolveDynamicValue(ASTNode node, ASTContext context) { public static FieldNode getFieldFromExpression(PropertyExpression node, ASTContext context) { ClassNode classNode = getTypeOfNode(node.getObjectExpression(), context); - if (classNode != null) { return classNode.getField(node.getProperty().getText()); } + if (classNode != null) { + return classNode.getField(node.getProperty().getText()); + } return null; } @@ -271,25 +293,35 @@ public static ClassNode getTypeOfNode(ASTNode node, ASTContext context) { } else if (node instanceof MethodCallExpression) { MethodCallExpression expression = (MethodCallExpression) node; ObjectMapper goh = getGohOfNode(expression, context); - if (goh != null) { return ClassHelper.makeCached(goh.getReturnType()); } + if (goh != null) { + return ClassHelper.makeCached(goh.getReturnType()); + } MethodNode methodNode = GroovyASTUtils.getMethodFromCallExpression(expression, context); - if (methodNode != null) { return methodNode.getReturnType(); } + if (methodNode != null) { + return methodNode.getReturnType(); + } return expression.getType(); } else if (node instanceof StaticMethodCallExpression expr) { MethodNode methodNode = GroovyASTUtils.getMethodFromCallExpression(expr, context); - if (methodNode != null) { return methodNode.getReturnType(); } + if (methodNode != null) { + return methodNode.getReturnType(); + } return expr.getType(); } else if (node instanceof PropertyExpression) { PropertyExpression expression = (PropertyExpression) node; PropertyNode propNode = GroovyASTUtils.getPropertyFromExpression(expression, context); - if (propNode != null) { return getTypeOfNode(propNode, context); } + if (propNode != null) { + return getTypeOfNode(propNode, context); + } return expression.getType(); } else if (node instanceof Variable) { Variable var = (Variable) node; if (var.getName().equals("this")) { ClassNode enclosingClass = (ClassNode) getEnclosingNodeOfType(node, ClassNode.class, context); - if (enclosingClass != null) { return enclosingClass; } + if (enclosingClass != null) { + return enclosingClass; + } } else if (var.isDynamicTyped()) { ASTNode defNode = GroovyASTUtils.getDefinition(node, false, context); if (defNode instanceof Variable) { @@ -307,7 +339,9 @@ public static ClassNode getTypeOfNode(ASTNode node, ASTContext context) { } } } - if (var.getOriginType() != null) { return var.getOriginType(); } + if (var.getOriginType() != null) { + return var.getOriginType(); + } } if (node instanceof Expression) { Expression expression = (Expression) node; @@ -358,8 +392,7 @@ public static MethodNode getMethodFromCallExpression(MethodCall node, ASTContext List possibleMethods = getMethodOverloadsFromCallExpression(node, context); if (!possibleMethods.isEmpty() && node.getArguments() instanceof ArgumentListExpression) { ArgumentListExpression actualArguments = (ArgumentListExpression) node.getArguments(); - MethodNode foundMethod = possibleMethods.stream().max(new Comparator() - { + MethodNode foundMethod = possibleMethods.stream().max(new Comparator() { public int compare(MethodNode m1, MethodNode m2) { Parameter[] p1 = m1.getParameters(); @@ -368,7 +401,9 @@ public int compare(MethodNode m1, MethodNode m2) { int m2Value = calculateArgumentsScore(p2, actualArguments, argIndex); if (m1Value > m2Value) { return 1; - } else if (m1Value < m2Value) { return -1; } + } else if (m1Value < m2Value) { + return -1; + } return 0; } }).orElse(null); @@ -413,7 +448,9 @@ private static int calculateArgumentsScore(Parameter[] parameters, ArgumentListE public static Range findAddImportRange(ASTNode offsetNode, ASTContext context) { ModuleNode moduleNode = (ModuleNode) GroovyASTUtils.getEnclosingNodeOfType(offsetNode, ModuleNode.class, context); - if (moduleNode == null) { return new Range(new Position(0, 0), new Position(0, 0)); } + if (moduleNode == null) { + return new Range(new Position(0, 0), new Position(0, 0)); + } ASTNode afterNode = null; if (afterNode == null) { List importNodes = moduleNode.getImports(); @@ -424,9 +461,13 @@ public static Range findAddImportRange(ASTNode offsetNode, ASTContext context) { if (afterNode == null) { afterNode = moduleNode.getPackage(); } - if (afterNode == null) { return new Range(new Position(0, 0), new Position(0, 0)); } + if (afterNode == null) { + return new Range(new Position(0, 0), new Position(0, 0)); + } Range nodeRange = GroovyLanguageServerUtils.astNodeToRange(afterNode); - if (nodeRange == null) { return new Range(new Position(0, 0), new Position(0, 0)); } + if (nodeRange == null) { + return new Range(new Position(0, 0), new Position(0, 0)); + } Position position = new Position(nodeRange.getEnd().getLine() + 1, 0); return new Range(position, position); } @@ -446,9 +487,13 @@ public static MethodNode methodNodeOfClosure(String name, Closure closure) { } public static ObjectMapper getGohOfNode(MethodCallExpression expr, ASTContext context) { - if (expr.isImplicitThis()) { return ObjectMapperManager.getObjectMapper(expr.getMethodAsString()); } + if (expr.isImplicitThis()) { + return ObjectMapperManager.getObjectMapper(expr.getMethodAsString()); + } ClassNode type = getTypeOfNode(expr.getObjectExpression(), context); - if (type != null) { return ObjectMapperManager.getObjectMapper(type.getTypeClass(), expr.getMethodAsString()); } + if (type != null) { + return ObjectMapperManager.getObjectMapper(type.getTypeClass(), expr.getMethodAsString()); + } return null; } @@ -457,7 +502,9 @@ public static void fillClassNode(ClassNode classNode) { Class clazz; try { clazz = classNode.getTypeClass(); - } catch (Exception ignored) { + } catch ( + Exception ignored + ) { return; } MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(clazz); diff --git a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java index b4ce0da4d..6bfabe4d1 100644 --- a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java +++ b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java @@ -96,7 +96,9 @@ public GroovyLSCompilationUnit create(Path workspaceRoot, @Nullable URI context) fileContentsTracker.getOpenURIs().forEach(uri -> { // if we're only tracking changes, skip all files that haven't // actually changed - if (urisToAdd != null && !urisToAdd.contains(uri)) { return; } + if (urisToAdd != null && !urisToAdd.contains(uri)) { + return; + } String contents = fileContentsTracker.getContents(uri); addOpenFileToCompilationUnit(uri, contents, compilationUnit); }); @@ -110,7 +112,9 @@ protected void addDirectoryToCompilationUnit(Path dirPath, GroovyLSCompilationUn try { if (Files.exists(dirPath)) { Files.walk(dirPath).forEach((filePath) -> { - if (!filePath.toString().endsWith(FILE_EXTENSION_GROOVY)) { return; } + if (!filePath.toString().endsWith(FILE_EXTENSION_GROOVY)) { + return; + } URI fileURI = filePath.toUri(); if (!fileContentsTracker.isOpen(fileURI)) { File file = filePath.toFile(); @@ -123,13 +127,19 @@ protected void addDirectoryToCompilationUnit(Path dirPath, GroovyLSCompilationUn }); } - } catch (IOException e) { + } catch ( + IOException e + ) { GroovyScript.LOGGER.error("Failed to walk directory for source files: {}", dirPath); } fileContentsTracker.getOpenURIs().forEach(uri -> { Path openPath = Paths.get(uri); - if (!openPath.normalize().startsWith(dirPath.normalize())) { return; } - if (changedUris != null && !changedUris.contains(uri)) { return; } + if (!openPath.normalize().startsWith(dirPath.normalize())) { + return; + } + if (changedUris != null && !changedUris.contains(uri)) { + return; + } String contents = fileContentsTracker.getContents(uri); addOpenFileToCompilationUnit(uri, contents, compilationUnit); }); diff --git a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java index bc6d41ae7..256af51c2 100644 --- a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java +++ b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java @@ -23,7 +23,9 @@ public abstract class CompilationUnitFactoryBase implements ICompilationUnitFact protected GroovyClassLoader classLoader; protected List additionalClasspathList; - public List getAdditionalClasspathList() { return additionalClasspathList; } + public List getAdditionalClasspathList() { + return additionalClasspathList; + } public void setAdditionalClasspathList(List additionalClasspathList) { this.additionalClasspathList = additionalClasspathList; @@ -54,7 +56,9 @@ protected CompilerConfiguration getConfiguration() { } protected void getClasspathList(List result) { - if (additionalClasspathList == null) { return; } + if (additionalClasspathList == null) { + return; + } for (String entry : additionalClasspathList) { boolean mustBeDirectory = false; diff --git a/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java b/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java index ea8404920..9e35f0612 100644 --- a/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java @@ -122,8 +122,10 @@ private boolean populateItemsFromNode(Position position, ASTNode offsetNode, Com private boolean populateItemsFromConstantExpression(ConstantExpression node, ASTNode parent, Completions items) { if (node.getType().getTypeClass() == String.class) { ASTNode parentParent = astContext.getVisitor().getParent(parent); - if (parentParent instanceof MethodCallExpression expr && expr.getArguments() instanceof ArgumentListExpression args && !args.getExpressions() - .isEmpty()) { + if ( + parentParent instanceof MethodCallExpression expr && expr.getArguments() instanceof ArgumentListExpression args && !args.getExpressions() + .isEmpty() + ) { ObjectMapper goh = GroovyASTUtils.getGohOfNode(expr, astContext); if (goh != null && goh.getCompleter() != null) { int index = -1; @@ -178,7 +180,9 @@ private static void populateItemsFromGameObjects(String memberNamePrefix, Set localClassItems = astContext.getVisitor().getClassNodes().stream().filter(classNode -> { String packageName = classNode.getPackageName(); - if (packageName == null || packageName.length() == 0 || packageName.equals(enclosingPackageName)) { return false; } + if (packageName == null || packageName.length() == 0 || packageName.equals(enclosingPackageName)) { + return false; + } String className = classNode.getName(); String classNameWithoutPackage = classNode.getNameWithoutPackage(); - if (!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) { return false; } - if (importNames.contains(className)) { return false; } + if (!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) { + return false; + } + if (importNames.contains(className)) { + return false; + } return true; }).map(classNode -> { CompletionItem item = CompletionItemFactory.createCompletion(classNode, classNode.getName(), astContext); @@ -229,7 +243,9 @@ private void populateItemsFromImportNode(ImportNode importNode, Position positio List packageItems = packages.stream().filter(packageInfo -> { String packageName = packageInfo.getName(); - if (packageName.startsWith(importText)) { return true; } + if (packageName.startsWith(importText)) { + return true; + } return false; }).map(packageInfo -> { CompletionItem item = CompletionItemFactory.createCompletion(CompletionItemKind.Module, packageInfo.getName()); @@ -240,11 +256,17 @@ private void populateItemsFromImportNode(ImportNode importNode, Position positio List classItems = classes.stream().filter(classInfo -> { String packageName = classInfo.getPackageName(); - if (packageName == null || packageName.length() == 0 || packageName.equals(enclosingPackageName)) { return false; } + if (packageName == null || packageName.length() == 0 || packageName.equals(enclosingPackageName)) { + return false; + } String className = classInfo.getName(); String classNameWithoutPackage = classInfo.getSimpleName(); - if (!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) { return false; } - if (importNames.contains(className)) { return false; } + if (!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) { + return false; + } + if (importNames.contains(className)) { + return false; + } return true; }).map(classInfo -> { CompletionItem item = CompletionItemFactory.createCompletion(classInfoToCompletionItemKind(classInfo), classInfo @@ -261,10 +283,14 @@ private void populateItemsFromImportNode(ImportNode importNode, Position positio private void populateItemsFromClassNode(ClassNode classNode, Position position, Completions items) { ASTNode parentNode = astContext.getVisitor().getParent(classNode); - if (!(parentNode instanceof ClassNode)) { return; } + if (!(parentNode instanceof ClassNode)) { + return; + } ClassNode parentClassNode = (ClassNode) parentNode; Range classRange = GroovyLanguageServerUtils.astNodeToRange(classNode); - if (classRange == null) { return; } + if (classRange == null) { + return; + } String className = getMemberName(classNode.getUnresolvedName(), classRange, position); if (classNode.equals(parentClassNode.getUnresolvedSuperClass())) { populateTypes(classNode, className, new HashSet<>(), true, false, false, items); @@ -276,14 +302,18 @@ private void populateItemsFromClassNode(ClassNode classNode, Position position, private void populateItemsFromConstructorCallExpression(ConstructorCallExpression constructorCallExpr, Position position, Completions items) { Range typeRange = GroovyLanguageServerUtils.astNodeToRange(constructorCallExpr.getType()); - if (typeRange == null) { return; } + if (typeRange == null) { + return; + } String typeName = getMemberName(constructorCallExpr.getType().getNameWithoutPackage(), typeRange, position); populateTypes(constructorCallExpr, typeName, new HashSet<>(), true, false, false, items); } private void populateItemsFromVariableExpression(VariableExpression varExpr, Position position, Completions items) { Range varRange = GroovyLanguageServerUtils.astNodeToRange(varExpr); - if (varRange == null) { return; } + if (varRange == null) { + return; + } String memberName = getMemberName(varExpr.getName(), varRange, position); populateItemsFromScope(varExpr, memberName, items); } @@ -408,7 +438,9 @@ private void populateItemsFromExpression(Expression leftSide, String memberNameP private void populateItemsFromGlobalScope(String memberNamePrefix, Set existingNames, List items) { astContext.getLanguageServerContext().getSandbox().getBindings().forEach((variableName, value) -> { - if (!variableName.startsWith(memberNamePrefix) || existingNames.contains(variableName)) { return; } + if (!variableName.startsWith(memberNamePrefix) || existingNames.contains(variableName)) { + return; + } existingNames.add(variableName); if (value instanceof ObjectMappergoh) { for (MethodNode method : goh.getMethodNodes()) { @@ -438,7 +470,9 @@ private void populateItemsFromGlobalScope(String memberNamePrefix, Set e .filter(ClassMemberInfo::isStatic)) .filter(methodInfo -> { String methodName = methodInfo.getName(); - if (methodName.startsWith(memberNamePrefix) && !existingNames.contains(methodName)) { + if ( + methodName.startsWith(memberNamePrefix) && !existingNames.contains(methodName) + ) { existingNames.add(methodName); return GroovyReflectionUtils.resolveMethodFromMethodInfo(methodInfo, astContext) @@ -519,7 +553,9 @@ private void populateItemsFromScope(ASTNode node, String namePrefix, Completions if (valueExpr instanceof ConstantExpression ce) { try { classNode = ClassHelper.makeCached(Class.forName(ce.getText())); - } catch (ClassNotFoundException ignored) {} + } catch ( + ClassNotFoundException ignored + ) {} } } if (classNode != null) { @@ -610,14 +646,20 @@ private void populateTypes(ASTNode offsetNode, String namePrefix, Set ex private String getMemberName(String memberName, Range range, Position position) { if (position.getLine() == range.getStart().getLine() && position.getCharacter() > range.getStart().getCharacter()) { int length = position.getCharacter() - range.getStart().getCharacter(); - if (length > 0 && length <= memberName.length()) { return memberName.substring(0, length).trim(); } + if (length > 0 && length <= memberName.length()) { + return memberName.substring(0, length).trim(); + } } return ""; } private CompletionItemKind classInfoToCompletionItemKind(ClassInfo classInfo) { - if (classInfo.isInterface()) { return CompletionItemKind.Interface; } - if (classInfo.isEnum()) { return CompletionItemKind.Enum; } + if (classInfo.isInterface()) { + return CompletionItemKind.Interface; + } + if (classInfo.isEnum()) { + return CompletionItemKind.Enum; + } return CompletionItemKind.Class; } diff --git a/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java b/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java index 35856c6fc..d83b0f197 100644 --- a/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java @@ -48,7 +48,9 @@ public CompletableFuture, List, List provideHover(TextDocumentIdentifier textDocument, Position position) { URI uri = URIUtils.toUri(textDocument.getUri()); ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(uri, position.getLine(), position.getCharacter()); - if (offsetNode == null) { return CompletableFuture.completedFuture(null); } + if (offsetNode == null) { + return CompletableFuture.completedFuture(null); + } ASTNode definitionNode = GroovyASTUtils.getDefinition(offsetNode, false, astContext); - if (definitionNode == null) { return CompletableFuture.completedFuture(null); } + if (definitionNode == null) { + return CompletableFuture.completedFuture(null); + } String content = getContent(definitionNode); - if (content == null) { return CompletableFuture.completedFuture(null); } + if (content == null) { + return CompletableFuture.completedFuture(null); + } String documentation = null; if (definitionNode instanceof AnnotatedNode annotatedNode) { diff --git a/src/main/java/net/prominic/groovyls/providers/ReferenceProvider.java b/src/main/java/net/prominic/groovyls/providers/ReferenceProvider.java index c2c55f05b..0ddc2dd3b 100644 --- a/src/main/java/net/prominic/groovyls/providers/ReferenceProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/ReferenceProvider.java @@ -47,7 +47,9 @@ public CompletableFuture> provideReferences(TextDocumen URI documentURI = URIUtils.toUri(textDocument.getUri()); ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(documentURI, position.getLine(), position .getCharacter()); - if (offsetNode == null) { return CompletableFuture.completedFuture(Collections.emptyList()); } + if (offsetNode == null) { + return CompletableFuture.completedFuture(Collections.emptyList()); + } List references = GroovyASTUtils.getReferences(offsetNode, astContext); List locations = references.stream().map(node -> { diff --git a/src/main/java/net/prominic/groovyls/providers/RenameProvider.java b/src/main/java/net/prominic/groovyls/providers/RenameProvider.java index 4048c09f7..1c649b17e 100644 --- a/src/main/java/net/prominic/groovyls/providers/RenameProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/RenameProvider.java @@ -75,7 +75,9 @@ public CompletableFuture provideRename(RenameParams renameParams) URI documentURI = URIUtils.toUri(textDocument.getUri()); ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(documentURI, position.getLine(), position .getCharacter()); - if (offsetNode == null) { return CompletableFuture.completedFuture(workspaceEdit); } + if (offsetNode == null) { + return CompletableFuture.completedFuture(workspaceEdit); + } List references = GroovyASTUtils.getReferences(offsetNode, astContext); references.forEach(node -> { @@ -125,7 +127,9 @@ public CompletableFuture provideRename(RenameParams renameParams) textEdit.setNewText(newName); textEdit.setRange(range); } - if (textEdit == null) { return; } + if (textEdit == null) { + return; + } if (!textEditChanges.containsKey(uri.toString())) { textEditChanges.put(uri.toString(), new ArrayList<>()); @@ -147,9 +151,13 @@ public CompletableFuture provideRename(RenameParams renameParams) private String getPartialNodeText(URI uri, ASTNode node) { Range range = GroovyLanguageServerUtils.astNodeToRange(node); - if (range == null) { return null; } + if (range == null) { + return null; + } String contents = files.getContents(uri); - if (contents == null) { return null; } + if (contents == null) { + return null; + } return Ranges.getSubstring(contents, range, 1); } diff --git a/src/main/java/net/prominic/groovyls/providers/SignatureHelpProvider.java b/src/main/java/net/prominic/groovyls/providers/SignatureHelpProvider.java index 87731ba7c..9ae6705b0 100644 --- a/src/main/java/net/prominic/groovyls/providers/SignatureHelpProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/SignatureHelpProvider.java @@ -50,7 +50,9 @@ public SignatureHelpProvider(ASTContext astContext) { public CompletableFuture provideSignatureHelp(TextDocumentIdentifier textDocument, Position position) { URI uri = URIUtils.toUri(textDocument.getUri()); ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(uri, position.getLine(), position.getCharacter()); - if (offsetNode == null) { return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); } + if (offsetNode == null) { + return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); + } int activeParamIndex = -1; MethodCall methodCall = null; ASTNode parentNode = astContext.getVisitor().getParent(offsetNode); @@ -63,10 +65,14 @@ public CompletableFuture provideSignatureHelp(TextDocumentIdentif activeParamIndex = getActiveParameter(position, expressions); } - if (methodCall == null) { return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); } + if (methodCall == null) { + return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); + } List methods = GroovyASTUtils.getMethodOverloadsFromCallExpression(methodCall, astContext); - if (methods.isEmpty()) { return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); } + if (methods.isEmpty()) { + return CompletableFuture.completedFuture(new SignatureHelp(Collections.emptyList(), -1, -1)); + } List sigInfos = new ArrayList<>(); for (MethodNode method : methods) { @@ -103,9 +109,12 @@ private int getActiveParameter(Position position, List expressions) if (exprRange == null) { continue; } - if (position.getLine() < exprRange.getEnd().getLine()) { return i; } - if (position.getLine() == exprRange.getEnd().getLine() && position.getCharacter() <= exprRange.getEnd() - .getCharacter()) { + if (position.getLine() < exprRange.getEnd().getLine()) { + return i; + } + if ( + position.getLine() == exprRange.getEnd().getLine() && position.getCharacter() <= exprRange.getEnd().getCharacter() + ) { return i; } } diff --git a/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java b/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java index d781ca61d..b69900f1b 100644 --- a/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java @@ -48,7 +48,9 @@ public CompletableFuture, List, List> provideWorkspaceSymb PropertyNode propNode = (PropertyNode) node; name = propNode.getName(); } - if (name == null) { return false; } + if (name == null) { + return false; + } return name.toLowerCase().contains(lowerCaseQuery); }).map(node -> { URI uri = astContext.getVisitor().getURI(node); diff --git a/src/main/java/net/prominic/groovyls/util/FileContentsTracker.java b/src/main/java/net/prominic/groovyls/util/FileContentsTracker.java index 33c4cbc10..8a49af8df 100644 --- a/src/main/java/net/prominic/groovyls/util/FileContentsTracker.java +++ b/src/main/java/net/prominic/groovyls/util/FileContentsTracker.java @@ -38,9 +38,13 @@ public class FileContentsTracker { private Map openFiles = new HashMap<>(); private Set changedFiles = new HashSet<>(); - public Set getOpenURIs() { return openFiles.keySet(); } + public Set getOpenURIs() { + return openFiles.keySet(); + } - public Set getChangedURIs() { return changedFiles; } + public Set getChangedURIs() { + return changedFiles; + } public void resetChangedFiles() { changedFiles = new HashSet<>(); @@ -96,13 +100,17 @@ public String getContents(URI uri) { builder.append((char) next); } return builder.toString(); - } catch (IOException e) { + } catch ( + IOException e + ) { return ""; } finally { if (reader != null) { try { reader.close(); - } catch (IOException e) {} + } catch ( + IOException e + ) {} } } } diff --git a/src/main/java/net/prominic/groovyls/util/GroovyLanguageServerUtils.java b/src/main/java/net/prominic/groovyls/util/GroovyLanguageServerUtils.java index d75491518..3cbac6d10 100644 --- a/src/main/java/net/prominic/groovyls/util/GroovyLanguageServerUtils.java +++ b/src/main/java/net/prominic/groovyls/util/GroovyLanguageServerUtils.java @@ -42,7 +42,9 @@ public class GroovyLanguageServerUtils { * May return null if the Groovy line is -1 */ public static Position createGroovyPosition(int groovyLine, int groovyColumn) { - if (groovyLine == -1) { return null; } + if (groovyLine == -1) { + return null; + } if (groovyColumn == -1) { groovyColumn = 0; } @@ -69,7 +71,9 @@ public static Range syntaxExceptionToRange(SyntaxException exception) { */ public static Range astNodeToRange(ASTNode node) { Position start = createGroovyPosition(node.getLineNumber(), node.getColumnNumber()); - if (start == null) { return null; } + if (start == null) { + return null; + } Position end = createGroovyPosition(node.getLastLineNumber(), node.getLastColumnNumber()); if (end == null) { end = start; @@ -82,12 +86,16 @@ public static CompletionItemKind astNodeToCompletionItemKind(ASTNode node) { ClassNode classNode = (ClassNode) node; if (classNode.isInterface()) { return CompletionItemKind.Interface; - } else if (classNode.isEnum()) { return CompletionItemKind.Enum; } + } else if (classNode.isEnum()) { + return CompletionItemKind.Enum; + } return CompletionItemKind.Class; } else if (node instanceof MethodNode) { return CompletionItemKind.Method; } else if (node instanceof Variable) { - if (node instanceof FieldNode || node instanceof PropertyNode) { return CompletionItemKind.Field; } + if (node instanceof FieldNode || node instanceof PropertyNode) { + return CompletionItemKind.Field; + } return CompletionItemKind.Variable; } return CompletionItemKind.Property; @@ -98,12 +106,16 @@ public static SymbolKind astNodeToSymbolKind(ASTNode node) { ClassNode classNode = (ClassNode) node; if (classNode.isInterface()) { return SymbolKind.Interface; - } else if (classNode.isEnum()) { return SymbolKind.Enum; } + } else if (classNode.isEnum()) { + return SymbolKind.Enum; + } return SymbolKind.Class; } else if (node instanceof MethodNode) { return SymbolKind.Method; } else if (node instanceof Variable) { - if (node instanceof FieldNode || node instanceof PropertyNode) { return SymbolKind.Field; } + if (node instanceof FieldNode || node instanceof PropertyNode) { + return SymbolKind.Field; + } return SymbolKind.Variable; } return SymbolKind.Property; @@ -115,20 +127,26 @@ public static SymbolKind astNodeToSymbolKind(ASTNode node) { */ public static Location astNodeToLocation(ASTNode node, URI uri) { Range range = astNodeToRange(node); - if (range == null) { return null; } + if (range == null) { + return null; + } return new Location(uri.toString(), range); } public static SymbolInformation astNodeToSymbolInformation(ClassNode node, URI uri, String parentName) { Location location = astNodeToLocation(node, uri); - if (location == null) { return null; } + if (location == null) { + return null; + } SymbolKind symbolKind = astNodeToSymbolKind(node); return new SymbolInformation(node.getName(), symbolKind, location, parentName); } public static SymbolInformation astNodeToSymbolInformation(MethodNode node, URI uri, String parentName) { Location location = astNodeToLocation(node, uri); - if (location == null) { return null; } + if (location == null) { + return null; + } SymbolKind symbolKind = astNodeToSymbolKind(node); return new SymbolInformation(node.getName(), symbolKind, location, parentName); } @@ -140,7 +158,9 @@ public static SymbolInformation astNodeToSymbolInformation(Variable node, URI ur } ASTNode astVar = (ASTNode) node; Location location = astNodeToLocation(astVar, uri); - if (location == null) { return null; } + if (location == null) { + return null; + } SymbolKind symbolKind = astNodeToSymbolKind(astVar); return new SymbolInformation(node.getName(), symbolKind, location, parentName); } diff --git a/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java b/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java index 6b0dcbf2c..a1861b16e 100644 --- a/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java +++ b/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java @@ -60,7 +60,9 @@ public static String classToString(ClassNode classNode, ASTContext astContext) { ClassNode superClass = null; try { superClass = classNode.getSuperClass(); - } catch (NoClassDefFoundError e) { + } catch ( + NoClassDefFoundError e + ) { // this is fine, we'll just treat it as null } if (superClass != null && !superClass.getName().equals(JAVA_OBJECT)) { @@ -80,7 +82,9 @@ public static String constructorToString(ConstructorNode constructorNode, ASTCon } public static String methodToString(MethodNode methodNode, ASTContext astContext) { - if (methodNode instanceof ConstructorNode) { return constructorToString((ConstructorNode) methodNode, astContext); } + if (methodNode instanceof ConstructorNode) { + return constructorToString((ConstructorNode) methodNode, astContext); + } StringBuilder builder = new StringBuilder(); if (methodNode.isPublic()) { if (!methodNode.isSyntheticPublic()) { diff --git a/src/main/java/net/prominic/groovyls/util/URIUtils.java b/src/main/java/net/prominic/groovyls/util/URIUtils.java index 1eec0f08b..d898299f9 100644 --- a/src/main/java/net/prominic/groovyls/util/URIUtils.java +++ b/src/main/java/net/prominic/groovyls/util/URIUtils.java @@ -15,7 +15,9 @@ public static URI toUri(String uriString) { decodedUriString = "file:///" + decodedUriString.substring(8, 9).toUpperCase() + decodedUriString.substring(9); } return URI.create(decodedUriString); - } catch (UnsupportedEncodingException e) { + } catch ( + UnsupportedEncodingException e + ) { throw new RuntimeException(e); } } diff --git a/src/main/java/net/prominic/lsp/utils/Positions.java b/src/main/java/net/prominic/lsp/utils/Positions.java index 0510c22c9..581aa527c 100644 --- a/src/main/java/net/prominic/lsp/utils/Positions.java +++ b/src/main/java/net/prominic/lsp/utils/Positions.java @@ -29,7 +29,9 @@ public class Positions { public static final Comparator COMPARATOR = (Position p1, Position p2) -> { - if (p1.getLine() != p2.getLine()) { return p1.getLine() - p2.getLine(); } + if (p1.getLine() != p2.getLine()) { + return p1.getLine() - p2.getLine(); + } return p1.getCharacter() - p2.getCharacter(); }; @@ -47,7 +49,9 @@ public static int getOffset(String string, Position position) { int readLines = 0; while (true) { char currentChar = (char) reader.read(); - if (currentChar == -1) { return -1; } + if (currentChar == -1) { + return -1; + } currentIndex++; if (currentChar == '\n') { readLines++; @@ -56,12 +60,16 @@ public static int getOffset(String string, Position position) { } } } - } catch (IOException e) { + } catch ( + IOException e + ) { return -1; } try { reader.close(); - } catch (IOException e) {} + } catch ( + IOException e + ) {} } return currentIndex + character; } diff --git a/src/main/java/net/prominic/lsp/utils/Ranges.java b/src/main/java/net/prominic/lsp/utils/Ranges.java index a91730842..a1d6a7c49 100644 --- a/src/main/java/net/prominic/lsp/utils/Ranges.java +++ b/src/main/java/net/prominic/lsp/utils/Ranges.java @@ -81,12 +81,16 @@ public static String getSubstring(String string, Range range, int maxLines) { for (int i = endCharStart; i < endChar; i++) { builder.append((char) reader.read()); } - } catch (IOException e) { + } catch ( + IOException e + ) { return null; } try { reader.close(); - } catch (IOException e) {} + } catch ( + IOException e + ) {} return builder.toString(); } }