diff --git a/build.gradle b/build.gradle index 2757b7967..892add046 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1720840170 +//version: 1723428048 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -1009,7 +1009,7 @@ abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { if (project.usesMixins.toBoolean()) { this.extraJvmArgs.addAll(project.provider(() -> { - def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create('zone.rong:mixinbooter:9.1')) + def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec)) mixinCfg.canBeConsumed = false mixinCfg.canBeResolved = true mixinCfg.transitive = false @@ -1391,7 +1391,7 @@ def getChangelog() { // Buildscript updating -def buildscriptGradleVersion = '8.5' +def buildscriptGradleVersion = '8.9' tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion diff --git a/editors/vscode/src/features/TextureDecoration.ts b/editors/vscode/src/features/TextureDecoration.ts index 7e65c71f6..1d87ade4c 100644 --- a/editors/vscode/src/features/TextureDecoration.ts +++ b/editors/vscode/src/features/TextureDecoration.ts @@ -87,5 +87,4 @@ export class TextureDecorationFeature extends TextDocumentLanguageFeature /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/spotless.eclipseformat.xml b/spotless.eclipseformat.xml new file mode 100644 index 000000000..86a556a89 --- /dev/null +++ b/spotless.eclipseformat.xml @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spotless.importorder b/spotless.importorder new file mode 100644 index 000000000..bf5e227ae --- /dev/null +++ b/spotless.importorder @@ -0,0 +1,4 @@ +#Organize Import Order +0= +1=javax|java +2=\# \ No newline at end of file diff --git a/src/main/java/com/cleanroommc/groovyscript/DisabledConfigGui.java b/src/main/java/com/cleanroommc/groovyscript/DisabledConfigGui.java index b76e691a5..da1b3a728 100644 --- a/src/main/java/com/cleanroommc/groovyscript/DisabledConfigGui.java +++ b/src/main/java/com/cleanroommc/groovyscript/DisabledConfigGui.java @@ -9,8 +9,7 @@ public class DisabledConfigGui implements IModGuiFactory { @Override - public void initialize(Minecraft minecraftInstance) { - } + public void initialize(Minecraft minecraftInstance) {} @Override public boolean hasConfigGui() { diff --git a/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java b/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java index 7ac410fe7..f972817b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java +++ b/src/main/java/com/cleanroommc/groovyscript/GroovyScript.java @@ -69,11 +69,12 @@ import java.util.Random; @GroovyBlacklist -@Mod(modid = GroovyScript.ID, - name = GroovyScript.NAME, - version = GroovyScript.VERSION, - dependencies = "after:mixinbooter@[8.0,);", - guiFactory = "com.cleanroommc.groovyscript.DisabledConfigGui") +@Mod( + modid = GroovyScript.ID, + name = GroovyScript.NAME, + version = GroovyScript.VERSION, + dependencies = "after:mixinbooter@[8.0,);", + guiFactory = "com.cleanroommc.groovyscript.DisabledConfigGui") @Mod.EventBusSubscriber(modid = GroovyScript.ID) public class GroovyScript { @@ -180,9 +181,10 @@ public static long runGroovyScriptsInLoader(LoadStage loadStage) { public void onPostInit(FMLPostInitializationEvent event) { CustomClickAction.registerAction("copy", value -> { GuiScreen.setClipboardString(value); - Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("groovyscript.command.copy.copied_start") - .appendSibling(new TextComponentString(value).setStyle(new Style().setColor(TextFormatting.GOLD))) - .appendSibling(new TextComponentTranslation("groovyscript.command.copy.copied_end"))); + Minecraft.getMinecraft().player.sendMessage( + new TextComponentTranslation("groovyscript.command.copy.copied_start") + .appendSibling(new TextComponentString(value).setStyle(new Style().setColor(TextFormatting.GOLD))) + .appendSibling(new TextComponentTranslation("groovyscript.command.copy.copied_end"))); }); } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/GroovyBlacklist.java b/src/main/java/com/cleanroommc/groovyscript/api/GroovyBlacklist.java index 5199fcaff..337247984 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/GroovyBlacklist.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/GroovyBlacklist.java @@ -9,6 +9,8 @@ * Use this annotation on fields, methods or classes to make them inaccessible for groovy. */ @Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR}) +@Target({ + ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR +}) public @interface GroovyBlacklist { } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java b/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java index e78083a4f..180d319f2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IIngredient.java @@ -69,8 +69,7 @@ public int getAmount() { } @Override - public void setAmount(int amount) { - } + public void setAmount(int amount) {} @Override public boolean isEmpty() { @@ -89,7 +88,9 @@ public Ingredient toMcIngredient() { @Override public ItemStack[] getMatchingStacks() { - return new ItemStack[]{ItemStack.EMPTY}; + return new ItemStack[]{ + ItemStack.EMPTY + }; } @Override @@ -104,8 +105,7 @@ public String getMark() { } @Override - public void setMark(String mark) { - } + public void setMark(String mark) {} }; /** @@ -121,6 +121,7 @@ public IIngredient exactCopy() { @Override public Ingredient toMcIngredient() { return new Ingredient() { + @Override public boolean apply(@Nullable ItemStack p_apply_1_) { return true; @@ -144,8 +145,7 @@ public int getAmount() { } @Override - public void setAmount(int amount) { - } + public void setAmount(int amount) {} @Override public boolean test(ItemStack stack) { @@ -159,7 +159,6 @@ public String getMark() { } @Override - public void setMark(String mark) { - } + public void setMark(String mark) {} }; } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/INamed.java b/src/main/java/com/cleanroommc/groovyscript/api/INamed.java index 56007cbc7..663f49a6f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/INamed.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/INamed.java @@ -18,5 +18,4 @@ default String getName() { default boolean isEnabled() { return true; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/IScriptReloadable.java b/src/main/java/com/cleanroommc/groovyscript/api/IScriptReloadable.java index 22311b0e3..e1627f9b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/IScriptReloadable.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/IScriptReloadable.java @@ -11,5 +11,4 @@ public interface IScriptReloadable extends INamed { @GroovyBlacklist @ApiStatus.OverrideOnly void afterScriptLoad(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Admonition.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Admonition.java index e2a927e33..52cf9b91d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Admonition.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Admonition.java @@ -11,7 +11,7 @@ * Admonition for Material for MkDocs. */ @Retention(RetentionPolicy.RUNTIME) -@Target({ /* No targets allowed */}) +@Target({}) // No targets allowed public @interface Admonition { /** @@ -86,6 +86,7 @@ enum Format { *
- {@link #EXAMPLE Example}: Indicates an example of some code in practice. */ enum Type { + /** * Indicates a generic comment - the most common type of Admonition. */ @@ -138,7 +139,5 @@ enum Type { public String toString() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); } - } - } 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 51cf2ff64..997af5883 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 @@ -25,7 +25,7 @@ * @see Property#comp() */ @Retention(RetentionPolicy.RUNTIME) -@Target({ /* No targets allowed */}) +@Target({}) // No targets allowed public @interface Comp { /** @@ -147,6 +147,7 @@ * */ enum Type { + GT(">", "groovyscript.wiki.greater_than"), GTE(">=", "groovyscript.wiki.greater_than_or_equal_to"), EQ("==", "groovyscript.wiki.equal_to"), @@ -191,7 +192,5 @@ public String getSymbol() { public String getKey() { return key; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Example.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Example.java index 9f2e8795f..04c47382a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Example.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Example.java @@ -23,7 +23,7 @@ * */ @Retention(RetentionPolicy.RUNTIME) -@Target({ /* No targets allowed */}) +@Target({}) // No targets allowed public @interface Example { /** @@ -92,5 +92,4 @@ * @return the example priority (relative to other examples for the same method or Recipe Builder) */ int priority() default 1000; - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java index b8f105091..35b1688fc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/MethodDescription.java @@ -97,5 +97,4 @@ enum Type { */ VALUE } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java index 39a5d42c9..22b61e6ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/Property.java @@ -45,7 +45,9 @@ */ @Repeatable(Property.Properties.class) @Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE}) +@Target({ + ElementType.FIELD, ElementType.TYPE +}) public @interface Property { /** @@ -226,7 +228,5 @@ @interface Properties { Property[] value(); - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java index 277274cdd..a4f6416fd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderDescription.java @@ -50,5 +50,4 @@ * @return the method priority (relative to other recipe builder priorities in the same class) */ int priority() default 1000; - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java index 4cc85bba4..38e42f9e8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/documentation/annotations/RecipeBuilderMethodDescription.java @@ -34,5 +34,4 @@ * @return the method priority */ int priority() default 1000; - } 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 d5926458f..ad81d596c 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 @@ -118,6 +118,7 @@ * - {@link Reloadability#DISABLED}: cannot be reloaded in-game, and requires a total minecraft restart to apply changes.
*/ enum Reloadability { + /** * Can be reloaded in-game, with each reload reproducing the same game-state as would be produced by restarting minecraft */ @@ -138,7 +139,6 @@ public boolean isReloadable() { public boolean hasFlaws() { return this == FLAWED; } - } /** @@ -146,6 +146,7 @@ public boolean hasFlaws() { * Currently, either specifically "recipes" or generically "entries" */ enum Category { + RECIPES("recipes"), ENTRIES("entries"); @@ -166,7 +167,5 @@ public String removing() { public String query() { return "groovyscript.wiki.query_" + category; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParser.java b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParser.java index 3c252e47d..ea9da3bfc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParser.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParser.java @@ -40,5 +40,4 @@ public interface InfoParser { * @see InfoParserPackage */ void parse(InfoParserPackage info, boolean enabled); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserPackage.java b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserPackage.java index 8791006ce..f8ae89e58 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserPackage.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserPackage.java @@ -177,5 +177,4 @@ public void parse() { public void parse(boolean enabled) { InfoParserRegistry.getInfoParsers().forEach(x -> x.parse(this, enabled)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserRegistry.java b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserRegistry.java index 7b3ea9542..5c9977412 100644 --- a/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/api/infocommand/InfoParserRegistry.java @@ -20,5 +20,4 @@ public static List getInfoParsers() { public static List getIds() { return INFO_PARSERS.stream().sorted(Comparator.comparing(InfoParser::priority)).map(InfoParser::id).collect(Collectors.toList()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/BaseInfoCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/BaseInfoCommand.java index 8dfd860b9..6b0d0185e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/BaseInfoCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/BaseInfoCommand.java @@ -81,10 +81,11 @@ protected static Entity getEntityLookingAt(EntityPlayer player) { @Override public @NotNull String getUsage(@NotNull ICommandSender sender) { - return String.format("/gs %s [all, pretty, %s, %s]", - getName(), - String.join(", ", InfoParserRegistry.getIds()), - InfoParserRegistry.getIds().stream().map(x -> "-" + x).collect(Collectors.joining(", "))); + return String.format( + "/gs %s [all, pretty, %s, %s]", + getName(), + String.join(", ", InfoParserRegistry.getIds()), + InfoParserRegistry.getIds().stream().map(x -> "-" + x).collect(Collectors.joining(", "))); } @Override @@ -93,7 +94,9 @@ public int getRequiredPermissionLevel() { } @Override - public @NotNull List getTabCompletions(@NotNull MinecraftServer server, @NotNull ICommandSender sender, String @NotNull [] args, + public @NotNull List getTabCompletions(@NotNull MinecraftServer server, + @NotNull ICommandSender sender, + String @NotNull [] args, @Nullable BlockPos targetPos) { List enabledModes = new ArrayList<>(); enabledModes.add("all"); @@ -146,5 +149,4 @@ public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sen print(player, messages, argList); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java index 452012aeb..a73933e03 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java @@ -29,17 +29,6 @@ public class GSCommand extends CommandTreeBase { - public static void runReload(EntityPlayerMP player, MinecraftServer server) { - if (server.isDedicatedServer()) { - player.sendMessage(new TextComponentString("Reloading in multiplayer is currently not allowed to avoid desync.")); - return; - } - GroovyLog.get().info("========== Reloading Groovy scripts =========="); - long time = GroovyScript.runGroovyScriptsInLoader(LoadStage.POST_INIT); - GroovyScript.postScriptRunResult(player, false, true, false, time); - NetworkHandler.sendToPlayer(new SReloadScripts(null, false, true), player); - } - public GSCommand() { addSubcommand(new SimpleCommand("log", (server, sender, args) -> postLogFiles(sender))); @@ -70,26 +59,36 @@ public GSCommand() { addSubcommand(new InfoLookingCommand()); addSubcommand(new InfoSelfCommand()); - addSubcommand(new SimpleCommand("wiki", (server, sender, args) -> sender.sendMessage( - new TextComponentString("GroovyScript wiki").setStyle(new Style().setColor(TextFormatting.GOLD).setHoverEvent( - new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new TextComponentString("Click to open wiki in browser"))).setClickEvent( - new ClickEvent(ClickEvent.Action.OPEN_URL, "https://cleanroommc.com/groovy-script/")))), "doc", "docs", - "documentation")); + addSubcommand( + new SimpleCommand( + "wiki", + (server, sender, args) -> sender.sendMessage( + new TextComponentString("GroovyScript wiki").setStyle( + new Style().setColor(TextFormatting.GOLD) + .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Click to open wiki in browser"))) + .setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://cleanroommc.com/groovy-script/")))), + "doc", + "docs", + "documentation")); addSubcommand(new SimpleCommand("generateWiki", (server, sender, args) -> { Documentation.generateWiki(); sender.sendMessage( new TextComponentString("Generated a local version of the Groovyscript wiki has been generated to the ").appendSibling( - getTextForFile("Wiki Folder", Documentation.WIKI.toPath().toString(), - new TextComponentString("Click to open the generated GroovyScript wiki folder")))); + getTextForFile( + "Wiki Folder", + Documentation.WIKI.toPath().toString(), + new TextComponentString("Click to open the generated GroovyScript wiki folder")))); }, "generateDoc", "generateDocs", "generateDocumentation")); addSubcommand(new SimpleCommand("generateExamples", (server, sender, args) -> { Documentation.generateExamples(); - sender.sendMessage(new TextComponentString("Generated examples for the enabled Groovyscript compat to the ").appendSibling( - getTextForFile("Examples Folder", Documentation.EXAMPLES.toPath().toString(), - new TextComponentString("Click to open the Groovyscript examples folder")))); + sender.sendMessage( + new TextComponentString("Generated examples for the enabled Groovyscript compat to the ").appendSibling( + getTextForFile( + "Examples Folder", + Documentation.EXAMPLES.toPath().toString(), + new TextComponentString("Click to open the Groovyscript examples folder")))); })); addSubcommand(new SimpleCommand("creativeTabs", (server, sender, args) -> { @@ -97,9 +96,12 @@ public GSCommand() { for (CreativeTabs tab : CreativeTabs.CREATIVE_TAB_ARRAY) { GroovyLog.get().getWriter().println(" - " + tab.getTabLabel()); } - sender.sendMessage(new TextComponentString("Creative tabs has been logged to the ").appendSibling( - GSCommand.getTextForFile("Groovy Log", GroovyLog.get().getLogFilePath().toString(), - new TextComponentString("Click to open GroovyScript log")))); + sender.sendMessage( + new TextComponentString("Creative tabs has been logged to the ").appendSibling( + GSCommand.getTextForFile( + "Groovy Log", + GroovyLog.get().getLogFilePath().toString(), + new TextComponentString("Click to open GroovyScript log")))); })); addSubcommand(new SimpleCommand("deleteScriptCache", (server, sender, args) -> { @@ -129,22 +131,15 @@ public GSCommand() { } } - @Override - @NotNull - public String getName() { - return "groovyscript"; - } - - @Override - @NotNull - public List getAliases() { - return Arrays.asList("grs", "GroovyScript", "gs"); - } - - @Override - @NotNull - public String getUsage(@NotNull ICommandSender sender) { - return "/grs []"; + public static void runReload(EntityPlayerMP player, MinecraftServer server) { + if (server.isDedicatedServer()) { + player.sendMessage(new TextComponentString("Reloading in multiplayer is currently not allowed to avoid desync.")); + return; + } + GroovyLog.get().info("========== Reloading Groovy scripts =========="); + long time = GroovyScript.runGroovyScriptsInLoader(LoadStage.POST_INIT); + GroovyScript.postScriptRunResult(player, false, true, false, time); + NetworkHandler.sendToPlayer(new SReloadScripts(null, false, true), player); } public static void postLogFiles(ICommandSender sender) { @@ -154,9 +149,7 @@ public static void postLogFiles(ICommandSender sender) { public static ITextComponent getTextForFile(String name, String path, ITextComponent hoverText) { return new TextComponentString(TextFormatting.UNDERLINE + (TextFormatting.GOLD + name)) - .setStyle(new Style() - .setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, path)) - .setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText))); + .setStyle(new Style().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, path)).setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText))); } public static boolean hasArgument(String[] args, String arg) { @@ -166,4 +159,21 @@ public static boolean hasArgument(String[] args, String arg) { return false; } + @Override + @NotNull + public String getName() { + return "groovyscript"; + } + + @Override + @NotNull + public List getAliases() { + return Arrays.asList("grs", "GroovyScript", "gs"); + } + + @Override + @NotNull + public String getUsage(@NotNull ICommandSender sender) { + return "/grs []"; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/InfoHandCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/InfoHandCommand.java index 8e7cef6ae..e9da3d386 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/InfoHandCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/InfoHandCommand.java @@ -28,5 +28,4 @@ void gatherInfo(InfoParserPackage info, EntityPlayer player) { info.setBlockState(itemBlock.getBlock().getStateFromMeta(info.getStack().getMetadata())); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/InfoInfoCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/InfoInfoCommand.java index 7103b26e5..c4d910632 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/InfoInfoCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/InfoInfoCommand.java @@ -38,5 +38,4 @@ void gatherInfo(InfoParserPackage info, EntityPlayer player) { info.setBlockState(itemBlock.getBlock().getStateFromMeta(info.getStack().getMetadata())); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/InfoLookingCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/InfoLookingCommand.java index 4106988ff..349be774b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/InfoLookingCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/InfoLookingCommand.java @@ -24,5 +24,4 @@ void gatherInfo(InfoParserPackage info, EntityPlayer player) { info.copyFromPos(getBlockLookingAt(player)); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/command/InfoSelfCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/InfoSelfCommand.java index d19f2a176..f002803b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/InfoSelfCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/InfoSelfCommand.java @@ -20,5 +20,4 @@ protected String targetDescription() { void gatherInfo(InfoParserPackage info, EntityPlayer player) { info.setEntity(player); } - } 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 f254c465e..3c8e0477b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/Content.java @@ -60,6 +60,7 @@ public GroovyFluid.Builder createFluid(String name) { public CreativeTabs createCreativeTab(String name, ItemStack icon) { return new CreativeTabs(name) { + @Override public @NotNull ItemStack createIcon() { return icon.copy(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java index 6fe92ec5f..eb8807b2b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyFluid.java @@ -219,9 +219,7 @@ public Fluid register() { FluidRegistry.registerFluid(fluid); FluidRegistry.addBucketForFluid(fluid); if (this.createBlock) { - BlockFluidBase block = this.finiteFluidBlock ? - new BlockFluidFinite(fluid, this.material) : - new BlockFluidClassic(fluid, this.material); + BlockFluidBase block = this.finiteFluidBlock ? new BlockFluidFinite(fluid, this.material) : new BlockFluidClassic(fluid, this.material); block.setRegistryName(new ResourceLocation(mod, this.name)); fluidBlocks.add(block); } 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 98060239a..ce871ad97 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/content/GroovyResourcePack.java @@ -40,4 +40,4 @@ public T getPackMetadata(@NotNull MetadataSerialize public @NotNull String getPackName() { return "GroovyScriptResources"; } -} \ No newline at end of file +} 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 4fc31e8ef..abfa7e19e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/Explosion.java @@ -8,7 +8,6 @@ import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import com.cleanroommc.groovyscript.sandbox.ClosureHelper; import groovy.lang.Closure; import net.minecraft.entity.item.EntityItem; 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 c9d9ef08c..feebda65e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToBlock.java @@ -139,8 +139,13 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable FluidToBlock.Recipe register() { - Recipe recipe = new Recipe(this.fluidInput.get(0).getFluid(), this.input.toArray(new IIngredient[0]), this.chances.toFloatArray(), - this.startCondition, this.afterRecipe, this.outputBlock); + Recipe recipe = new Recipe( + this.fluidInput.get(0).getFluid(), + this.input.toArray(new IIngredient[0]), + this.chances.toFloatArray(), + this.startCondition, + this.afterRecipe, + this.outputBlock); VanillaModule.inWorldCrafting.fluidToBlock.add(recipe); return recipe; } 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 64b4bf1ae..c0534d2a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToFluid.java @@ -125,8 +125,13 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable Recipe register() { - Recipe recipe = new Recipe(this.fluidInput.get(0).getFluid(), this.input.toArray(new IIngredient[0]), this.chances.toFloatArray(), - this.startCondition, this.afterRecipe, this.fluidOutput.get(0).getFluid()); + Recipe recipe = new Recipe( + this.fluidInput.get(0).getFluid(), + this.input.toArray(new IIngredient[0]), + this.chances.toFloatArray(), + this.startCondition, + this.afterRecipe, + this.fluidOutput.get(0).getFluid()); VanillaModule.inWorldCrafting.fluidToFluid.add(recipe); return recipe; } 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 8c51d2b26..1c7c82021 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/FluidToItem.java @@ -149,8 +149,14 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable FluidToItem.Recipe register() { - Recipe recipe = new Recipe(this.fluidInput.get(0).getFluid(), this.input.toArray(new IIngredient[0]), this.chances.toFloatArray(), - this.startCondition, this.afterRecipe, this.output.get(0), this.fluidConsumptionChance); + Recipe recipe = new Recipe( + this.fluidInput.get(0).getFluid(), + this.input.toArray(new IIngredient[0]), + this.chances.toFloatArray(), + this.startCondition, + this.afterRecipe, + this.output.get(0), + this.fluidConsumptionChance); VanillaModule.inWorldCrafting.fluidToItem.add(recipe); return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/InWorldCraftingJeiPlugin.java b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/InWorldCraftingJeiPlugin.java index b589743ec..89469a3c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/InWorldCraftingJeiPlugin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/inworldcrafting/jei/InWorldCraftingJeiPlugin.java @@ -42,5 +42,4 @@ public static void register(IModRegistry registry) { registry.addRecipes(VanillaModule.inWorldCrafting.burning.getRecipeWrappers(), BurningRecipeCategory.UID); registry.addRecipes(VanillaModule.inWorldCrafting.pistonPush.getRecipeWrappers(), PistonPushRecipeCategory.UID); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootCondition.java b/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootCondition.java index 427da5a39..0dfb95db8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootCondition.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootCondition.java @@ -12,11 +12,15 @@ public class GroovyLootCondition implements LootCondition { + private static final Class[] CLOSURE_CLASSES = { + Random.class, LootContext.class + }; + public final Closure condition; public GroovyLootCondition(Closure condition) { this.condition = condition; - if (!Arrays.equals(condition.getParameterTypes(), new Class[]{Random.class, LootContext.class})) { + if (!Arrays.equals(condition.getParameterTypes(), CLOSURE_CLASSES)) { GroovyLog.msg("Warning: LootCondition closures must take the following parameters (java.util.Random, net.minecraft.world.storage.loot.LootContext)") .debug() .post(); @@ -27,5 +31,4 @@ public GroovyLootCondition(Closure condition) { public boolean testCondition(@NotNull Random rand, @NotNull LootContext context) { return ClosureHelper.call(true, condition, rand, context); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootFunction.java b/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootFunction.java index 73f908906..25df34e1b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootFunction.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/GroovyLootFunction.java @@ -14,6 +14,10 @@ public class GroovyLootFunction extends LootFunction { + private static final Class[] CLOSURE_CLASSES = { + ItemStack.class, Random.class, LootContext.class + }; + private final Closure function; public GroovyLootFunction(Closure function) { @@ -23,7 +27,7 @@ public GroovyLootFunction(Closure function) { public GroovyLootFunction(LootCondition[] conditions, Closure function) { super(conditions); this.function = function; - if (!Arrays.equals(function.getParameterTypes(), new Class[]{ItemStack.class, Random.class, LootContext.class})) { + if (!Arrays.equals(function.getParameterTypes(), CLOSURE_CLASSES)) { GroovyLog.msg("Warning: LootFunction closures must take the following parameters (net.minecraft.item.ItemStack, java.util.Random, net.minecraft.world.storage.loot.LootContext)") .debug() .post(); @@ -34,5 +38,4 @@ public GroovyLootFunction(LootCondition[] conditions, Closure function) public @NotNull ItemStack apply(@NotNull ItemStack stack, @NotNull Random rand, @NotNull LootContext context) { return ClosureHelper.call(stack, function, stack, rand, context); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/loot/Loot.java b/src/main/java/com/cleanroommc/groovyscript/compat/loot/Loot.java index 6875dfd78..8be92a335 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/Loot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/Loot.java @@ -43,5 +43,4 @@ public void afterScriptLoad() { } } } - } 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 d677d6c2a..5f1327b79 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootEntryBuilder.java @@ -144,7 +144,7 @@ public LootEntryBuilder enchantRandomly(Enchantment enchantment, LootCondition.. public LootEntryBuilder enchantRandomly(Enchantment[] enchantments, LootCondition... conditions) { List list = (enchantments != null) ? Lists.newArrayList(enchantments) : null; - this.functions.add(new EnchantRandomly((conditions == null)? EMPTY_CONDITIONS : conditions, list)); + this.functions.add(new EnchantRandomly((conditions == null) ? EMPTY_CONDITIONS : conditions, list)); return this; } @@ -164,7 +164,7 @@ public LootEntryBuilder lootingBonus(float min, float max, int limit, LootCondit out.add(min < 0.0f, () -> "lootingEnchantBonus minimum cannot be less than 0."); out.add(max < 0.0f, () -> "lootingEnchantBonus maximum cannot be less than 0."); out.add(limit < 0, () -> "lootingEnchantBonus limit cannot be less than 0."); - this.functions.add(new LootingEnchantBonus((conditions == null)? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)), Math.max(limit, 0))); + this.functions.add(new LootingEnchantBonus((conditions == null) ? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)), Math.max(limit, 0))); return this; } @@ -183,7 +183,7 @@ public LootEntryBuilder setDamage(int min, int max) { public LootEntryBuilder setDamage(int min, int max, LootCondition... conditions) { out.add(min < 0 || min >= 32767, () -> "setDamage minimum cannot be less than 0 or more than 32766."); out.add(max < 0 || min >= 32767, () -> "setDamage maximum cannot be less than 0 or more than 32766."); - this.functions.add(new SetDamage((conditions == null)? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); + this.functions.add(new SetDamage((conditions == null) ? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); return this; } @@ -202,7 +202,7 @@ public LootEntryBuilder setCount(int min, int max) { public LootEntryBuilder setCount(int min, int max, LootCondition... conditions) { out.add(min < 0, () -> "setCount minimum cannot be less than 0."); out.add(max < 0, () -> "setCount maximum cannot be less than 0."); - this.functions.add(new SetCount((conditions == null)? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); + this.functions.add(new SetCount((conditions == null) ? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); return this; } @@ -221,7 +221,7 @@ public LootEntryBuilder setMetadata(int min, int max) { public LootEntryBuilder setMetadata(int min, int max, LootCondition... conditions) { out.add(min < 0 || min >= 32767, () -> "setMetadata minimum cannot be less than 0 or more than 32766."); out.add(max < 0 || min >= 32767, () -> "setMetadata maximum cannot be less than 0 or more than 32766."); - this.functions.add(new SetMetadata((conditions == null)? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); + this.functions.add(new SetMetadata((conditions == null) ? EMPTY_CONDITIONS : conditions, new RandomValueRange(Math.max(min, 0.0f), Math.max(max, 0.0f)))); return this; } @@ -256,7 +256,7 @@ public LootEntryBuilder setNBT(Map tag, LootCondition... conditi } public LootEntryBuilder setNBT(NBTTagCompound tag, LootCondition... conditions) { - this.functions.add(new SetNBT((conditions == null)? EMPTY_CONDITIONS : conditions, tag)); + this.functions.add(new SetNBT((conditions == null) ? EMPTY_CONDITIONS : conditions, tag)); return this; } @@ -332,9 +332,8 @@ public LootEntry build() { public void register() { if (!validate(true)) return; - VanillaModule.loot.tables.get(tableName).getPool(poolName).addEntry( - new LootEntryItem(item, weight, quality, functions.toArray(new LootFunction[0]), conditions.toArray(new LootCondition[0]), name) - ); + VanillaModule.loot.tables.get(tableName) + .getPool(poolName) + .addEntry(new LootEntryItem(item, weight, quality, functions.toArray(new LootFunction[0]), conditions.toArray(new LootCondition[0]), name)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootPoolBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootPoolBuilder.java index 55314495b..80b7308d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootPoolBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/loot/LootPoolBuilder.java @@ -53,10 +53,12 @@ public LootPoolBuilder entry(LootEntry entry) { } public LootPoolBuilder entry(ItemStack stack, int weight) { - this.lootEntries.add(new LootEntryBuilder() - .name(stack.getItem().getRegistryName().getNamespace() + ":" + stack.getMetadata()) - .item(stack) - .weight(weight).build()); + this.lootEntries.add( + new LootEntryBuilder() + .name(stack.getItem().getRegistryName().getNamespace() + ":" + stack.getMetadata()) + .item(stack) + .weight(weight) + .build()); return this; } @@ -133,9 +135,9 @@ public LootPool build() { public void register() { if (!validate(true)) return; - VanillaModule.loot.tables.get(tableName).addPool( - new LootPool(lootEntries.toArray(new LootEntry[0]), poolConditions.toArray(new LootCondition[0]), rolls, bonusRolls, name) - ); + VanillaModule.loot.tables.get(tableName) + .addPool( + new LootPool(lootEntries.toArray(new LootEntry[0]), poolConditions.toArray(new LootCondition[0]), rolls, bonusRolls, name) + ); } - -} \ No newline at end of file +} 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 0950602c8..081e0b1d2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/GroovyPropertyContainer.java @@ -47,13 +47,12 @@ public Map getProperties() { */ @GroovyBlacklist @ApiStatus.OverrideOnly - public void initialize(GroovyContainer owner) { - } + public void initialize(GroovyContainer owner) {} protected void addPropertyFieldsOf(Object object, boolean privateToo) { boolean staticOnly = false; Class clazz; - if (object instanceof Class c) { + if (object instanceof Classc) { clazz = c; staticOnly = true; } else { @@ -61,10 +60,7 @@ 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); @@ -78,4 +74,3 @@ protected void addPropertyFieldsOf(Object object, boolean privateToo) { } } } - 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 1333a67c6..efd2c5005 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/InternalModContainer.java @@ -78,6 +78,5 @@ public T get() { } @Override - public void onCompatLoaded(GroovyContainer container) { - } + public void onCompatLoaded(GroovyContainer container) {} } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/ActuallyAdditions.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/ActuallyAdditions.java index 4640e6e26..b8a6b6fcc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/ActuallyAdditions.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/ActuallyAdditions.java @@ -13,5 +13,4 @@ public class ActuallyAdditions extends GroovyPropertyContainer { public final AtomicReconstructor atomicReconstructor = new AtomicReconstructor(); public final NetherMiningLens netherMiningLens = new NetherMiningLens(); public final StoneMiningLens stoneMiningLens = new StoneMiningLens(); - } 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 827eaa175..fa0633d2d 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 @@ -104,7 +104,9 @@ public RecipeBuilder time(int time) { return this; } - @RecipeBuilderMethodDescription(field = {"red", "green", "blue"}) + @RecipeBuilderMethodDescription(field = { + "red", "green", "blue" + }) public RecipeBuilder particleColor(float... color) { if (color.length != 3) { GroovyLog.get().warn("Error setting color in Actually Additions Empowerer recipe. color must contain 3 floats, yet it contained {}", color.length); @@ -116,13 +118,17 @@ public RecipeBuilder particleColor(float... color) { return this; } - @RecipeBuilderMethodDescription(field = {"red", "green", "blue"}) + @RecipeBuilderMethodDescription(field = { + "red", "green", "blue" + }) public RecipeBuilder color(float... color) { return this.particleColor(color); } - @RecipeBuilderMethodDescription(field = {"red", "green", "blue"}) + @RecipeBuilderMethodDescription(field = { + "red", "green", "blue" + }) public RecipeBuilder particleColor(int hex) { Color color = new Color(hex); this.red = color.getRed() / 255.0f; @@ -132,7 +138,9 @@ public RecipeBuilder particleColor(int hex) { } - @RecipeBuilderMethodDescription(field = {"red", "green", "blue"}) + @RecipeBuilderMethodDescription(field = { + "red", "green", "blue" + }) public RecipeBuilder color(int hex) { return this.particleColor(hex); } @@ -195,7 +203,9 @@ public void validate(GroovyLog.Msg msg) { input.get(3).toMcIngredient(), energyPerStand, time, - new float[]{red, green, blue} + new float[]{ + red, green, blue + } ); ModSupport.ACTUALLY_ADDITIONS.get().empowerer.add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/AdvancedMortars.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/AdvancedMortars.java index ce9d03c15..14e6f5231 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/AdvancedMortars.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedmortars/AdvancedMortars.java @@ -5,5 +5,4 @@ public class AdvancedMortars extends GroovyPropertyContainer { public final Mortar mortar = new Mortar(); - } 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 fb8daa71d..2b55b1c44 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 @@ -166,7 +166,9 @@ public RecipeBuilder secondaryOutput(ItemStack itemStack) { return this; } - @RecipeBuilderMethodDescription(field = {"secondaryOutput", "secondaryOutputChance"}) + @RecipeBuilderMethodDescription(field = { + "secondaryOutput", "secondaryOutputChance" + }) public RecipeBuilder secondaryOutput(ItemStack itemStack, float chance) { this.secondaryOutput = itemStack; this.secondaryOutputChance = chance; @@ -207,5 +209,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/AdvancedRocketry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/AdvancedRocketry.java index 83301a4a8..04bfcb3e8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/AdvancedRocketry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/AdvancedRocketry.java @@ -1,19 +1,18 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; - -public class AdvancedRocketry extends GroovyPropertyContainer { - - public final Centrifuge centrifuge = new Centrifuge(); - public final ChemicalReactor reactor = new ChemicalReactor(); - public final Crystallizer crystallizer = new Crystallizer(); - public final CuttingMachine cutting = new CuttingMachine(); - public final ElectricArcFurnace arcFurnace = new ElectricArcFurnace(); - public final Electrolyser electrolyser = new Electrolyser(); - public final Lathe lathe = new Lathe(); - public final PrecisionAssembler assembler = new PrecisionAssembler(); - public final PrecisionLaserEtcher laserEtcher = new PrecisionLaserEtcher(); - public final RollingMachine rolling = new RollingMachine(); - public final SmallPlatePresser platePress = new SmallPlatePresser(); - -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; + +public class AdvancedRocketry extends GroovyPropertyContainer { + + public final Centrifuge centrifuge = new Centrifuge(); + public final ChemicalReactor reactor = new ChemicalReactor(); + public final Crystallizer crystallizer = new Crystallizer(); + public final CuttingMachine cutting = new CuttingMachine(); + public final ElectricArcFurnace arcFurnace = new ElectricArcFurnace(); + public final Electrolyser electrolyser = new Electrolyser(); + public final Lathe lathe = new Lathe(); + public final PrecisionAssembler assembler = new PrecisionAssembler(); + public final PrecisionLaserEtcher laserEtcher = new PrecisionLaserEtcher(); + public final RollingMachine rolling = new RollingMachine(); + public final SmallPlatePresser platePress = new SmallPlatePresser(); +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/BaseRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/BaseRegistry.java index 1e5c3485d..88e558a3a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/BaseRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/BaseRegistry.java @@ -1,198 +1,199 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.Comp; -import com.cleanroommc.groovyscript.api.documentation.annotations.Property; -import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderRegistrationMethod; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import zmaster587.libVulpes.interfaces.IRecipe; -import zmaster587.libVulpes.recipe.RecipesMachine; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -import java.util.*; - -public abstract class BaseRegistry extends StandardListRegistry { - - protected abstract Class getMachineClass(); - - @Override - @NotNull - @SuppressWarnings("unchecked") - public Collection getRecipes() { - Class clazz = getMachineClass(); - RecipesMachine registry = RecipesMachine.getInstance(); - List recipes = registry.getRecipes(clazz); - if (recipes == null) { - recipes = new LinkedList<>(); - // NOTE: this cast is completely invalid but Advanced Rocketry's code is abusing type erasure on Class generic - // to perform the same cast when adding recipes to Small Plate Press (which is not a TileMultiblockMachine) - registry.recipeList.put((Class) clazz, recipes); - } - return recipes; - } - - public boolean removeByFluidInput(FluidStack fluidStack) { - return getRecipes().removeIf(r -> { - List inputFluid = r.getFluidIngredients(); - if (inputFluid.stream().anyMatch(fluidIn -> fluidIn.isFluidEqual(fluidStack))) { - addBackup(r); - return true; - } - return false; - }); - } - - public boolean removeByInput(IIngredient inputItem) { - if (inputItem instanceof FluidStack) { - return removeByFluidInput((FluidStack) inputItem); - } - return getRecipes().removeIf(r -> { - List> input = r.getIngredients(); - if (input.stream().anyMatch(itemStacks -> itemStacks.stream().anyMatch(inputItem))) { - addBackup(r); - return true; - } - return false; - }); - } - - public boolean removeByFluidOutput(FluidStack fluidStack) { - return getRecipes().removeIf(r -> { - List outputFluid = r.getFluidOutputs(); - if (outputFluid.stream().anyMatch(fluidOut -> fluidOut.isFluidEqual(fluidStack))) { - addBackup(r); - return true; - } - return false; - }); - } - - public boolean removeByOutput(IIngredient outputItem) { - if (outputItem instanceof FluidStack) { - return removeByFluidInput((FluidStack) outputItem); - } - return getRecipes().removeIf(r -> { - List output = r.getOutput(); - if (output.stream().anyMatch(outputItem)) { - addBackup(r); - return true; - } - return false; - }); - } - - public abstract static class RecipeBuilder extends AbstractRecipeBuilder { - // still have to override the Validate method + add getRegistry method - - @Property(value = "groovyscript.wiki.advancedrocketry.power.value", needsOverride = true) - protected int power = 0; - @Property(value = "groovyscript.wiki.advancedrocketry.time.value", needsOverride = true) - protected int time = 0; - @Property(value = "groovyscript.wiki.advancedrocketry.outputSize.value", needsOverride = true) - protected int outputSize = 0; - - protected final List outputChances = new ArrayList<>(); - - // 0.0f is used because that's what AR uses for "100% chance". Copium. - @Override - @RecipeBuilderMethodDescription - public RecipeBuilder output(ItemStack output) { - return output(output, 0.0f); - } - - @RecipeBuilderMethodDescription(field = {"output", "outputChances"}) - protected RecipeBuilder output(ItemStack output, float chance) { - this.output.add(output); - this.outputChances.add(chance); - return this; - } - - @Override - public String getErrorMsg() { - return String.format("Error adding Advanced Rocketry %s recipe", getRegistry().getName()); - } - - protected int getHatchesNeeded() { - return (int) (Math.ceil(((double) input.size()) / 4) + Math.ceil(((double) output.size()) / 4) + fluidInput.size() + fluidOutput.size()); - } - - protected abstract BaseRegistry getRegistry(); - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable IRecipe register() { - if (!validate()) return null; - List> inputs = new LinkedList<>(); - Map oredicts = new HashMap<>(); - for (int i = 0; i < input.size(); i++) { - IIngredient in = input.get(i); - inputs.add(Arrays.asList(in.getMatchingStacks())); - if (in instanceof OreDictIngredient) { - oredicts.put(i, ((OreDictIngredient) in).getOreDict()); - } - } - - List outputs = new LinkedList<>(); - for (int i = 0; i < output.size(); i++) { - ItemStack out = output.get(i); - float chance = outputChances.get(i); - outputs.add(new RecipesMachine.ChanceItemStack(out, chance)); - } - - List fluidOutputs = new LinkedList<>(); - for (FluidStack out : fluidOutput) { - // Fluid chances don't work properly, at least in the centrifuge. - fluidOutputs.add(new RecipesMachine.ChanceFluidStack(out, 1.0f)); - } - - RecipesMachine.Recipe r = new RecipesMachine.Recipe(outputs, inputs, fluidOutputs, fluidInput, time, power, oredicts); - if (outputSize > 0) r.setMaxOutputSize(outputSize); - getRegistry().add(r); - return r; - } - } - - @Property(property = "power", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.power.value", hierarchy = 5) - @Property(property = "time", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.time.value", hierarchy = 5) - @Property(property = "outputSize", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.outputSize.value", hierarchy = 5) - public abstract static class MultiblockRecipeBuilder extends RecipeBuilder { - - @RecipeBuilderMethodDescription - public MultiblockRecipeBuilder time(int time) { - this.time = time; - return this; - } - - @RecipeBuilderMethodDescription - public MultiblockRecipeBuilder power(int power) { - this.power = power; - return this; - } - - @RecipeBuilderMethodDescription - public MultiblockRecipeBuilder outputSize(int outputSize) { - this.outputSize = outputSize; - return this; - } - - @Override - @RecipeBuilderMethodDescription - public RecipeBuilder output(ItemStack output) { - return output(output, 0.0f); - } - - @Override - @RecipeBuilderMethodDescription - public RecipeBuilder output(ItemStack output, float chance) { - return super.output(output, chance); - } - } - -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.Comp; +import com.cleanroommc.groovyscript.api.documentation.annotations.Property; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderRegistrationMethod; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import zmaster587.libVulpes.interfaces.IRecipe; +import zmaster587.libVulpes.recipe.RecipesMachine; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +import java.util.*; + +public abstract class BaseRegistry extends StandardListRegistry { + + protected abstract Class getMachineClass(); + + @Override + @NotNull + @SuppressWarnings("unchecked") + public Collection getRecipes() { + Class clazz = getMachineClass(); + RecipesMachine registry = RecipesMachine.getInstance(); + List recipes = registry.getRecipes(clazz); + if (recipes == null) { + recipes = new LinkedList<>(); + // NOTE: this cast is completely invalid but Advanced Rocketry's code is abusing type erasure on Class generic + // to perform the same cast when adding recipes to Small Plate Press (which is not a TileMultiblockMachine) + registry.recipeList.put((Class) clazz, recipes); + } + return recipes; + } + + public boolean removeByFluidInput(FluidStack fluidStack) { + return getRecipes().removeIf(r -> { + List inputFluid = r.getFluidIngredients(); + if (inputFluid.stream().anyMatch(fluidIn -> fluidIn.isFluidEqual(fluidStack))) { + addBackup(r); + return true; + } + return false; + }); + } + + public boolean removeByInput(IIngredient inputItem) { + if (inputItem instanceof FluidStack) { + return removeByFluidInput((FluidStack) inputItem); + } + return getRecipes().removeIf(r -> { + List> input = r.getIngredients(); + if (input.stream().anyMatch(itemStacks -> itemStacks.stream().anyMatch(inputItem))) { + addBackup(r); + return true; + } + return false; + }); + } + + public boolean removeByFluidOutput(FluidStack fluidStack) { + return getRecipes().removeIf(r -> { + List outputFluid = r.getFluidOutputs(); + if (outputFluid.stream().anyMatch(fluidOut -> fluidOut.isFluidEqual(fluidStack))) { + addBackup(r); + return true; + } + return false; + }); + } + + public boolean removeByOutput(IIngredient outputItem) { + if (outputItem instanceof FluidStack) { + return removeByFluidInput((FluidStack) outputItem); + } + return getRecipes().removeIf(r -> { + List output = r.getOutput(); + if (output.stream().anyMatch(outputItem)) { + addBackup(r); + return true; + } + return false; + }); + } + + public abstract static class RecipeBuilder extends AbstractRecipeBuilder { + // still have to override the Validate method + add getRegistry method + + @Property(value = "groovyscript.wiki.advancedrocketry.power.value", needsOverride = true) + protected int power = 0; + @Property(value = "groovyscript.wiki.advancedrocketry.time.value", needsOverride = true) + protected int time = 0; + @Property(value = "groovyscript.wiki.advancedrocketry.outputSize.value", needsOverride = true) + protected int outputSize = 0; + + protected final List outputChances = new ArrayList<>(); + + // 0.0f is used because that's what AR uses for "100% chance". Copium. + @Override + @RecipeBuilderMethodDescription + public RecipeBuilder output(ItemStack output) { + return output(output, 0.0f); + } + + @RecipeBuilderMethodDescription(field = { + "output", "outputChances" + }) + protected RecipeBuilder output(ItemStack output, float chance) { + this.output.add(output); + this.outputChances.add(chance); + return this; + } + + @Override + public String getErrorMsg() { + return String.format("Error adding Advanced Rocketry %s recipe", getRegistry().getName()); + } + + protected int getHatchesNeeded() { + return (int) (Math.ceil(((double) input.size()) / 4) + Math.ceil(((double) output.size()) / 4) + fluidInput.size() + fluidOutput.size()); + } + + protected abstract BaseRegistry getRegistry(); + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable IRecipe register() { + if (!validate()) return null; + List> inputs = new LinkedList<>(); + Map oredicts = new HashMap<>(); + for (int i = 0; i < input.size(); i++) { + IIngredient in = input.get(i); + inputs.add(Arrays.asList(in.getMatchingStacks())); + if (in instanceof OreDictIngredient) { + oredicts.put(i, ((OreDictIngredient) in).getOreDict()); + } + } + + List outputs = new LinkedList<>(); + for (int i = 0; i < output.size(); i++) { + ItemStack out = output.get(i); + float chance = outputChances.get(i); + outputs.add(new RecipesMachine.ChanceItemStack(out, chance)); + } + + List fluidOutputs = new LinkedList<>(); + for (FluidStack out : fluidOutput) { + // Fluid chances don't work properly, at least in the centrifuge. + fluidOutputs.add(new RecipesMachine.ChanceFluidStack(out, 1.0f)); + } + + RecipesMachine.Recipe r = new RecipesMachine.Recipe(outputs, inputs, fluidOutputs, fluidInput, time, power, oredicts); + if (outputSize > 0) r.setMaxOutputSize(outputSize); + getRegistry().add(r); + return r; + } + } + + @Property(property = "power", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.power.value", hierarchy = 5) + @Property(property = "time", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.time.value", hierarchy = 5) + @Property(property = "outputSize", comp = @Comp(gte = 1), value = "groovyscript.wiki.advancedrocketry.outputSize.value", hierarchy = 5) + public abstract static class MultiblockRecipeBuilder extends RecipeBuilder { + + @RecipeBuilderMethodDescription + public MultiblockRecipeBuilder time(int time) { + this.time = time; + return this; + } + + @RecipeBuilderMethodDescription + public MultiblockRecipeBuilder power(int power) { + this.power = power; + return this; + } + + @RecipeBuilderMethodDescription + public MultiblockRecipeBuilder outputSize(int outputSize) { + this.outputSize = outputSize; + return this; + } + + @Override + @RecipeBuilderMethodDescription + public RecipeBuilder output(ItemStack output) { + return output(output, 0.0f); + } + + @Override + @RecipeBuilderMethodDescription + public RecipeBuilder output(ItemStack output, float chance) { + return super.output(output, chance); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Centrifuge.java index c688a8d8d..41306fadf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Centrifuge.java @@ -1,51 +1,52 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileCentrifuge; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = { - @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING), - @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.output_slots", type = Admonition.Type.WARNING), -}) -public class Centrifuge extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".fluidInput(fluid('lava') * 500).output(item('minecraft:slime_ball'), 0.1f).output(item('minecraft:stone'), 0.9f).fluidOutput(fluid('enrichedlava') * 500).power(50).time(100).outputSize(1)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileCentrifuge.class; - } - - @Override - @MethodDescription(example = @Example("fluid('enrichedlava')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "fluidInput", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(lte = 12), value = "groovyscript.wiki.advancedrocketry.output.value") - @Property(property = "fluidOutput", comp = @Comp(lte = 4)) - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().centrifuge; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 0, 0, 0, 12); - validateFluids(msg, 1, 1, 0, 4); - msg.add(fluidOutput.isEmpty() && output.isEmpty(), "No outputs provided!"); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileCentrifuge; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = { + @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING), + @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.output_slots", type = Admonition.Type.WARNING), +}) +public class Centrifuge extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".fluidInput(fluid('lava') * 500).output(item('minecraft:slime_ball'), 0.1f).output(item('minecraft:stone'), 0.9f).fluidOutput(fluid('enrichedlava') * 500).power(50).time(100).outputSize(1)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileCentrifuge.class; + } + + @Override + @MethodDescription(example = @Example("fluid('enrichedlava')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "fluidInput", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(lte = 12), value = "groovyscript.wiki.advancedrocketry.output.value") + @Property(property = "fluidOutput", comp = @Comp(lte = 4)) + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().centrifuge; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 0, 0, 0, 12); + validateFluids(msg, 1, 1, 0, 4); + msg.add(fluidOutput.isEmpty() && output.isEmpty(), "No outputs provided!"); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ChemicalReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ChemicalReactor.java index d9123c50e..f045bc5cd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ChemicalReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ChemicalReactor.java @@ -1,60 +1,60 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileChemicalReactor; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = { - @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING), - @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.input_slots", type = Admonition.Type.WARNING), -}) -public class ChemicalReactor extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:chorus_fruit_popped')).fluidInput(fluid('lava') * 500)" + - ".output(item('minecraft:end_rod') * 4).fluidOutput(fluid('water') * 500).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileChemicalReactor.class; - } - - @Override - @MethodDescription(example = @Example("item('minecraft:leather_helmet')")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('minecraft:bone')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(lte = 8, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "fluidInput", comp = @Comp(lte = 2, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "output", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.output.required"), value = "groovyscript.wiki.advancedrocketry.output.value") - @Property(property = "fluidOutput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.output.required")) - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().reactor; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 0, 8, 0, 4); - validateFluids(msg, 0, 2, 0, 1); - msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); - msg.add(output.isEmpty() && fluidOutput.isEmpty(), "No outputs provided!"); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileChemicalReactor; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = { + @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING), + @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.input_slots", type = Admonition.Type.WARNING), +}) +public class ChemicalReactor extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:chorus_fruit_popped')).fluidInput(fluid('lava') * 500)" + ".output(item('minecraft:end_rod') * 4).fluidOutput(fluid('water') * 500).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileChemicalReactor.class; + } + + @Override + @MethodDescription(example = @Example("item('minecraft:leather_helmet')")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('minecraft:bone')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(lte = 8, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "fluidInput", comp = @Comp(lte = 2, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "output", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.output.required"), value = "groovyscript.wiki.advancedrocketry.output.value") + @Property(property = "fluidOutput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.output.required")) + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().reactor; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 0, 8, 0, 4); + validateFluids(msg, 0, 2, 0, 1); + msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); + msg.add(output.isEmpty() && fluidOutput.isEmpty(), "No outputs provided!"); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Crystallizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Crystallizer.java index 23ae66b73..f8247aecf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Crystallizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Crystallizer.java @@ -1,56 +1,57 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileCrystallizer; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class Crystallizer extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:blaze_powder') * 4).output(item('minecraft:blaze_rod')).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileCrystallizer.class; - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productgem')")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productingot', 3)")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "fluidInput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "output", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.output.required"), value = "groovyscript.wiki.advancedrocketry.output.value") - @Property(property = "fluidOutput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.output.required")) - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().crystallizer; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 0, 4, 0, 4); - validateFluids(msg, 0, 1, 0, 1); - msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); - msg.add(output.isEmpty() && fluidOutput.isEmpty(), "No outputs provided!"); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileCrystallizer; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class Crystallizer extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:blaze_powder') * 4).output(item('minecraft:blaze_rod')).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileCrystallizer.class; + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productgem')")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productingot', 3)")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "fluidInput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "output", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.output.required"), value = "groovyscript.wiki.advancedrocketry.output.value") + @Property(property = "fluidOutput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.output.required")) + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().crystallizer; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 0, 4, 0, 4); + validateFluids(msg, 0, 1, 0, 1); + msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); + msg.add(output.isEmpty() && fluidOutput.isEmpty(), "No outputs provided!"); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/CuttingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/CuttingMachine.java index 2c03e6fd9..b3ee14d1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/CuttingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/CuttingMachine.java @@ -1,53 +1,56 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileCuttingMachine; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class CuttingMachine extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:blaze_rod')).output(item('minecraft:blaze_powder') * 4).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileCuttingMachine.class; - } - - @Override - @MethodDescription(example = @Example("item('minecraft:planks', 1)")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('advancedrocketry:alienwood')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) - @Property(property = "output", comp = @Comp(gte = 1, lte = 4), - value = "groovyscript.wiki.advancedrocketry.output.value") - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().cutting; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 4, 1, 4); - validateFluids(msg); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileCuttingMachine; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class CuttingMachine extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:blaze_rod')).output(item('minecraft:blaze_powder') * 4).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileCuttingMachine.class; + } + + @Override + @MethodDescription(example = @Example("item('minecraft:planks', 1)")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('advancedrocketry:alienwood')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) + @Property( + property = "output", + comp = @Comp(gte = 1, lte = 4), + value = "groovyscript.wiki.advancedrocketry.output.value") + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().cutting; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 4, 1, 4); + validateFluids(msg); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ElectricArcFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ElectricArcFurnace.java index 8a3079c66..3cb9871b3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ElectricArcFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/ElectricArcFurnace.java @@ -14,6 +14,7 @@ @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.hatch_count_11", type = Admonition.Type.INFO), }) public class ElectricArcFurnace extends BaseRegistry { + @RecipeBuilderDescription( example = @Example(".input(item('minecraft:blaze_powder') * 4).output(item('minecraft:blaze_rod')).power(50).time(100)")) public RecipeBuilder recipeBuilder() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Electrolyser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Electrolyser.java index c345ce314..e1808da92 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Electrolyser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Electrolyser.java @@ -1,52 +1,53 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileElectrolyser; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class Electrolyser extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".fluidInput(fluid('lava') * 10).fluidOutput(fluid('nitrogen') * 50).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileElectrolyser.class; - } - - @Override - @MethodDescription(example = @Example(value = "fluid('oxygen')", commented = true)) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("fluid('water')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "fluidInput", comp = @Comp(eq = 1)) - @Property(property = "fluidOutput", comp = @Comp(gte = 1, lte = 2)) - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().electrolyser; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg); - validateFluids(msg, 1, 1, 1, 2); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileElectrolyser; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class Electrolyser extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".fluidInput(fluid('lava') * 10).fluidOutput(fluid('nitrogen') * 50).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileElectrolyser.class; + } + + @Override + @MethodDescription(example = @Example(value = "fluid('oxygen')", commented = true)) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("fluid('water')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "fluidInput", comp = @Comp(eq = 1)) + @Property(property = "fluidOutput", comp = @Comp(gte = 1, lte = 2)) + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().electrolyser; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg); + validateFluids(msg, 1, 1, 1, 2); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Lathe.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Lathe.java index f2785a4ea..42515250f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Lathe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/Lathe.java @@ -1,52 +1,53 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileLathe; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class Lathe extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(ore('plankWood')).output(item('minecraft:stick') * 2).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileLathe.class; - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productrod', 4)")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productingot', 6)")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) - @Property(property = "output", comp = @Comp(gte = 1, lte = 4), value = "groovyscript.wiki.advancedrocketry.output.value") - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().lathe; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 4, 1, 4); - validateFluids(msg); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileLathe; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class Lathe extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(ore('plankWood')).output(item('minecraft:stick') * 2).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileLathe.class; + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productrod', 4)")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productingot', 6)")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) + @Property(property = "output", comp = @Comp(gte = 1, lte = 4), value = "groovyscript.wiki.advancedrocketry.output.value") + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().lathe; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 4, 1, 4); + validateFluids(msg); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionAssembler.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionAssembler.java index ef715f332..d0ee7ca33 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionAssembler.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionAssembler.java @@ -61,5 +61,4 @@ public void validate(GroovyLog.Msg msg) { msg.add(time < 1, "Time must be 1 or greater, got {}", time); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionLaserEtcher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionLaserEtcher.java index 801bf6f68..682de307b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionLaserEtcher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/PrecisionLaserEtcher.java @@ -1,53 +1,56 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TilePrecisionLaserEtcher; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class PrecisionLaserEtcher extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:blaze_powder') * 4, item('advancedrocketry:wafer')).output(item('advancedrocketry:itemcircuitplate')).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TilePrecisionLaserEtcher.class; - } - - @Override - @MethodDescription(example = @Example("item('advancedrocketry:itemcircuitplate')")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('minecraft:redstone_block')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) - @Property(property = "output", comp = @Comp(gte = 1, lte = 4), - value = "groovyscript.wiki.advancedrocketry.output.value") - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().laserEtcher; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 4, 1, 4); - validateFluids(msg); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TilePrecisionLaserEtcher; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class PrecisionLaserEtcher extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:blaze_powder') * 4, item('advancedrocketry:wafer')).output(item('advancedrocketry:itemcircuitplate')).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TilePrecisionLaserEtcher.class; + } + + @Override + @MethodDescription(example = @Example("item('advancedrocketry:itemcircuitplate')")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('minecraft:redstone_block')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(gte = 1, lte = 4)) + @Property( + property = "output", + comp = @Comp(gte = 1, lte = 4), + value = "groovyscript.wiki.advancedrocketry.output.value") + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().laserEtcher; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 4, 1, 4); + validateFluids(msg); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/RollingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/RollingMachine.java index 5c6d442e7..fd88739ba 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/RollingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/RollingMachine.java @@ -1,54 +1,55 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import zmaster587.advancedRocketry.tile.multiblock.machine.TileRollingMachine; -import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) -public class RollingMachine extends BaseRegistry { - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:snow'), fluid('water') * 300).output(item('minecraft:snow_layer') * 2).power(50).time(100)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return TileRollingMachine.class; - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productsheet', 1)")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productplate')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "fluidInput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.input.required")) - @Property(property = "output", comp = @Comp(gte = 1, lte = 4), value = "groovyscript.wiki.advancedrocketry.output.value") - public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().rolling; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 0, 4, 1, 4); - validateFluids(msg, 0, 1, 0, 0); - msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); - msg.add(power < 1, "Power must be 1 or greater, got {}", power); - msg.add(time < 1, "Time must be 1 or greater, got {}", time); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import zmaster587.advancedRocketry.tile.multiblock.machine.TileRollingMachine; +import zmaster587.libVulpes.tile.multiblock.TileMultiblockMachine; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.advancedrocketry.admonition.weights", type = Admonition.Type.WARNING)) +public class RollingMachine extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:snow'), fluid('water') * 300).output(item('minecraft:snow_layer') * 2).power(50).time(100)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return TileRollingMachine.class; + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productsheet', 1)")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productplate')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(lte = 4, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "fluidInput", comp = @Comp(lte = 1, unique = "groovyscript.wiki.advancedrocketry.input.required")) + @Property(property = "output", comp = @Comp(gte = 1, lte = 4), value = "groovyscript.wiki.advancedrocketry.output.value") + public static class RecipeBuilder extends BaseRegistry.MultiblockRecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().rolling; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 0, 4, 1, 4); + validateFluids(msg, 0, 1, 0, 0); + msg.add(input.isEmpty() && fluidInput.isEmpty(), "No inputs provided!"); + msg.add(power < 1, "Power must be 1 or greater, got {}", power); + msg.add(time < 1, "Time must be 1 or greater, got {}", time); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/SmallPlatePresser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/SmallPlatePresser.java index 578e507ae..deb9a1a21 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/SmallPlatePresser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/advancedrocketry/SmallPlatePresser.java @@ -1,55 +1,55 @@ -package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import net.minecraft.item.ItemBlock; -import zmaster587.advancedRocketry.block.BlockSmallPlatePress; - -import java.util.Arrays; - -@RegistryDescription -public class SmallPlatePresser extends BaseRegistry { - - @RecipeBuilderDescription( - example = @Example(".input(item('minecraft:cobblestone')).output(item('minecraft:diamond'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - protected Class getMachineClass() { - return BlockSmallPlatePress.class; - } - - @Override - @MethodDescription(example = @Example("item('libvulpes:productplate', 2)")) - public boolean removeByOutput(IIngredient output) { - return super.removeByOutput(output); - } - - @Override - @MethodDescription(example = @Example("item('minecraft:iron_block')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - - @Property(property = "input", comp = @Comp(eq = 1, unique = "groovyscript.wiki.advancedrocketry.input.block")) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends BaseRegistry.RecipeBuilder { - - @Override - protected BaseRegistry getRegistry() { - return ModSupport.ADVANCED_ROCKETRY.get().platePress; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 1); - validateFluids(msg); - boolean allBlocks = Arrays.stream(input.get(0).getMatchingStacks()).allMatch(s -> s.getItem() instanceof ItemBlock); - msg.add(!allBlocks, "All inputs to Small Plate Press recipes must be blocks!"); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.advancedrocketry; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import net.minecraft.item.ItemBlock; +import zmaster587.advancedRocketry.block.BlockSmallPlatePress; + +import java.util.Arrays; + +@RegistryDescription +public class SmallPlatePresser extends BaseRegistry { + + @RecipeBuilderDescription( + example = @Example(".input(item('minecraft:cobblestone')).output(item('minecraft:diamond'))")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + protected Class getMachineClass() { + return BlockSmallPlatePress.class; + } + + @Override + @MethodDescription(example = @Example("item('libvulpes:productplate', 2)")) + public boolean removeByOutput(IIngredient output) { + return super.removeByOutput(output); + } + + @Override + @MethodDescription(example = @Example("item('minecraft:iron_block')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + + @Property(property = "input", comp = @Comp(eq = 1, unique = "groovyscript.wiki.advancedrocketry.input.block")) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends BaseRegistry.RecipeBuilder { + + @Override + protected BaseRegistry getRegistry() { + return ModSupport.ADVANCED_ROCKETRY.get().platePress; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); + boolean allBlocks = Arrays.stream(input.get(0).getMatchingStacks()).allMatch(s -> s.getItem() instanceof ItemBlock); + msg.add(!allBlocks, "All inputs to Small Plate Press recipes must be blocks!"); + } + } +} 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 68ef1af55..f3a612ffa 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 @@ -90,5 +90,4 @@ public void validate(GroovyLog.Msg msg) { return accessory; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Aether.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Aether.java index ac38eca74..0581f44a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Aether.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Aether.java @@ -9,5 +9,4 @@ public class Aether extends GroovyPropertyContainer { public final Freezer freezer = new Freezer(); public final FreezerFuel freezerFuel = new FreezerFuel(); public final Accessory accessory = new Accessory(); - } 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 f3b9a66ec..6d6691564 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 @@ -78,5 +78,4 @@ public void validate(GroovyLog.Msg msg) { return enchantment; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java index 48259357c..20535860f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java @@ -21,9 +21,10 @@ public EnchanterFuel() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:blaze_rod'), 1000")) public void add(ItemStack fuel, int timeGiven) { if (IngredientHelper.overMaxSize(fuel, 1)) { - GroovyLog.msg("Error adding Enchanter Fuel").error() - .add("Fuel must have stack size of 1, got {}", fuel.getCount()) - .post(); + GroovyLog.msg("Error adding Enchanter Fuel") + .error() + .add("Fuel must have stack size of 1, got {}", fuel.getCount()) + .post(); return; } AetherEnchantmentFuel enchantmentFuel = new AetherEnchantmentFuel(fuel, timeGiven); 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 3d9371355..a3253f2ef 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 @@ -77,5 +77,4 @@ public void validate(GroovyLog.Msg msg) { return freezable; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java index 3ae553430..cb55df350 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java @@ -21,9 +21,10 @@ public FreezerFuel() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:packed_ice'), 1000")) public void add(ItemStack fuel, int timeGiven) { if (IngredientHelper.overMaxSize(fuel, 1)) { - GroovyLog.msg("Error adding Freezer Fuel").error() - .add("Fuel must have stack size of 1, got {}", fuel.getCount()) - .post(); + GroovyLog.msg("Error adding Freezer Fuel") + .error() + .add("Fuel must have stack size of 1, got {}", fuel.getCount()) + .post(); return; } AetherFreezableFuel freezableFuel = new AetherFreezableFuel(fuel, timeGiven); 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 5b89b5209..0b98bb9ed 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 @@ -132,11 +132,16 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public ElectrolyzerRecipe register() { if (!validate()) return null; - ElectrolyzerRecipe recipe = new ElectrolyzerRecipe(fluidInput.get(0), - input.size() >= 1 ? input.get(0).toMcIngredient() : Ingredient.EMPTY, consumptionChance, - output.get(0), output.getOrEmpty(1), - output.getOrEmpty(2), chance.size() >= 1 ? chance.getInt(0) : 0, - output.getOrEmpty(3), chance.size() >= 2 ? chance.getInt(1) : 0); + ElectrolyzerRecipe recipe = new ElectrolyzerRecipe( + fluidInput.get(0), + input.size() >= 1 ? input.get(0).toMcIngredient() : Ingredient.EMPTY, + consumptionChance, + output.get(0), + output.getOrEmpty(1), + output.getOrEmpty(2), + chance.size() >= 1 ? chance.getInt(0) : 0, + output.getOrEmpty(3), + chance.size() >= 2 ? chance.getInt(1) : 0); ModSupport.ALCHEMISTRY.get().electrolyzer.add(recipe); return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserCompound.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserCompound.java index 845e0b7cf..c37da5951 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserCompound.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserCompound.java @@ -35,5 +35,4 @@ public void parse(InfoParserPackage info) { } } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserElement.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserElement.java index faa277cfc..2aaa6c8b4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserElement.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/alchemistry/InfoParserElement.java @@ -35,5 +35,4 @@ public void parse(InfoParserPackage info) { } } } - } 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 112aff676..d14f7876e 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 @@ -77,7 +77,8 @@ public void remove(Capability capability, TunnelType tunnel) { @MethodDescription public void removeByItem(ItemStack item) { - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getTunnels().entrySet() + for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getTunnels() + .entrySet() .stream() .filter(x -> x.getKey().isItemEqual(item)) .collect(Collectors.toList())) { @@ -88,7 +89,8 @@ public void removeByItem(ItemStack item) { @MethodDescription public void removeByMod(String modid) { - for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getModIdTunnels().entrySet() + for (Map.Entry pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getModIdTunnels() + .entrySet() .stream() .filter(x -> x.getKey().equals(modid)) .collect(Collectors.toList())) { @@ -99,7 +101,8 @@ public void removeByMod(String modid) { @MethodDescription public void removeByCapability(Capability capability) { - for (Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels().entrySet() + for (Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels() + .entrySet() .stream() .filter(x -> x.getKey() == capability) .collect(Collectors.toList())) { @@ -110,21 +113,24 @@ 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() + 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() + 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() + for (Map.Entry, TunnelType> pair : ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels() + .entrySet() .stream() .filter(x -> x.getValue() == tunnel) .collect(Collectors.toList())) { @@ -142,5 +148,4 @@ public void removeAll() { ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels().forEach((item, value) -> addBackup(Pair.of(item, value))); ((P2PTunnelRegistryAccessor) AEApi.instance().registries().p2pTunnel()).getCapTunnels().clear(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java index cd658313b..37ab5fda5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java @@ -30,9 +30,10 @@ public void onReload() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:clay'), 10000")) public void add(ItemStack item, double value) { if (IngredientHelper.overMaxSize(item, 1)) { - GroovyLog.msg("Error adding Cannon Ammo").error() - .add("Item must have stack size of 1, got {}", item.getCount()) - .post(); + GroovyLog.msg("Error adding Cannon Ammo") + .error() + .add("Item must have stack size of 1, got {}", item.getCount()) + .post(); return; } addScripted(Pair.of(item, value)); @@ -50,5 +51,4 @@ public void removeAll() { ((MatterCannonAmmoRegistryAccessor) AEApi.instance().registries().matterCannon()).getDamageModifiers().forEach((item, value) -> addBackup(Pair.of(item, value))); ((MatterCannonAmmoRegistryAccessor) AEApi.instance().registries().matterCannon()).getDamageModifiers().clear(); } - } 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 df5f7e55d..e01a6b7c4 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 @@ -89,7 +89,9 @@ public RecipeBuilder turns(int turns) { return this; } - @RecipeBuilderMethodDescription(field = {"chance1", "chance2"}) + @RecipeBuilderMethodDescription(field = { + "chance1", "chance2" + }) public RecipeBuilder chance(float chance1, float chance2) { this.chance1 = chance1; this.chance2 = chance2; @@ -126,7 +128,10 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable IGrinderRecipe register() { if (!validate()) return null; - IGrinderRecipeBuilder builder = AEApi.instance().registries().grinder().builder() + IGrinderRecipeBuilder builder = AEApi.instance() + .registries() + .grinder() + .builder() .withInput(input.get(0).toMcIngredient().getMatchingStacks()[0]) .withOutput(output.get(0)) .withTurns(turns); @@ -137,5 +142,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/InfoParserTunnel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/InfoParserTunnel.java index 25e6c1a71..9ad08c597 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/InfoParserTunnel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/InfoParserTunnel.java @@ -35,5 +35,4 @@ public void parse(InfoParserPackage info) { if (tunnelType == null) return; instance.add(info.getMessages(), tunnelType, info.isPrettyNbt()); } - } 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 a64adb732..8a9d7b064 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 @@ -133,7 +133,10 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable IInscriberRecipe register() { if (!validate()) return null; - IInscriberRecipeBuilder builder = AEApi.instance().registries().inscriber().builder() + IInscriberRecipeBuilder builder = AEApi.instance() + .registries() + .inscriber() + .builder() .withInputs(input.stream().flatMap(x -> Arrays.stream(x.toMcIngredient().getMatchingStacks())).collect(Collectors.toList())) .withOutput(output.get(0)) .withProcessType(type); @@ -144,5 +147,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/ArcaneArchives.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/ArcaneArchives.java index b0431bfa1..17b02ced0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/ArcaneArchives.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/arcanearchives/ArcaneArchives.java @@ -5,5 +5,4 @@ public class ArcaneArchives extends GroovyPropertyContainer { public final GemCuttingTable gemCuttingTable = new GemCuttingTable(); - } 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 61976cb4f..f11e1c4b7 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 @@ -55,7 +55,8 @@ public boolean remove(IGCTRecipe recipe) { @MethodDescription(example = @Example("item('minecraft:gold_nugget')")) public boolean removeByInput(IIngredient input) { return GCTRecipeList.instance.getRecipes().values().removeIf(recipe -> { - boolean found = recipe.getIngredients().stream() + boolean found = recipe.getIngredients() + .stream() .map(IngredientStack::getIngredient) .map(Ingredient::getMatchingStacks) .flatMap(Arrays::stream) @@ -122,5 +123,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 49da053ad..20e14d75c 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 @@ -43,8 +43,7 @@ public LiquidInteraction add(int probability, FluidStack component1, FluidStack @MethodDescription public void removeByInput(Fluid fluid1, Fluid fluid2) { getRecipes().removeIf(rec -> { - if ((rec.getComponent1().getFluid().equals(fluid1) && rec.getComponent2().getFluid().equals(fluid2)) || - (rec.getComponent1().getFluid().equals(fluid2) && rec.getComponent2().getFluid().equals(fluid1))) { + if ((rec.getComponent1().getFluid().equals(fluid1) && rec.getComponent2().getFluid().equals(fluid2)) || (rec.getComponent1().getFluid().equals(fluid2) && rec.getComponent2().getFluid().equals(fluid1))) { addBackup(rec); return true; } @@ -93,48 +92,64 @@ public static class RecipeBuilder extends AbstractRecipeBuilder> { + private static final Class[] CLOSURE_CLASSES = { + int.class, long.class + }; + @Override @GroovyBlacklist @ApiStatus.Internal @@ -28,7 +32,7 @@ public void onReload() { @MethodDescription(example = @Example(value = "{ int i, long prev -> prev + 1000L + MathHelper.lfloor(Math.pow(2.0, i / 2.0F + 3)) }", imports = "net.minecraft.util.math.MathHelper"), type = MethodDescription.Type.VALUE) public void setXpFunction(Closure func) { - if (!Arrays.equals(func.getParameterTypes(), new Class[]{int.class, long.class})) { + if (!Arrays.equals(func.getParameterTypes(), CLOSURE_CLASSES)) { GroovyLog.msg("Warning: Astral Perk xp closures must take the following parameters (int levelNumber, long previousLevelXp)").debug().post(); } this.xpFunction = func; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarInputOrder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarInputOrder.java index ecb4e8316..353d66bb3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarInputOrder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/starlightaltar/AltarInputOrder.java @@ -7,6 +7,7 @@ public class AltarInputOrder { + // @formatter:off public static final int[][] DISCOVERY = new int[][]{ {0, 1, 2}, {3, 4, 5}, @@ -33,6 +34,7 @@ public class AltarInputOrder { {17, 6, 7, 8, 18}, {11, 19, 24, 20, 12} }; + // @formatter:on public static int[][] getMap(TileAltar.AltarLevel level) { return switch (level) { @@ -55,5 +57,4 @@ public static ItemHandle[] initInputList(TileAltar.AltarLevel level) { if (rVal != null) Arrays.fill(rVal, null); return rVal; } - } 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 04c3fe42b..3f2d301f7 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 @@ -62,6 +62,7 @@ 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)) { + @Override public int getPassiveStarlightRequired() { return starlightRequired; @@ -81,6 +82,7 @@ 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)) { + @Override public int getPassiveStarlightRequired() { return starlightRequired; @@ -113,6 +115,7 @@ 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)) { + @Override public int getPassiveStarlightRequired() { return starlightRequired; @@ -155,6 +158,7 @@ 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)) { + @Override public int getPassiveStarlightRequired() { return starlightRequired; @@ -380,4 +384,4 @@ public AbstractAltarRecipe register() { return recipe; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/atum/Atum.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/atum/Atum.java index 0cc49b9a1..16f6247dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/atum/Atum.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/atum/Atum.java @@ -7,5 +7,4 @@ public class Atum extends GroovyPropertyContainer { public final Kiln kiln = new Kiln(); public final Quern quern = new Quern(); public final SpinningWheel spinningWheel = new SpinningWheel(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Avaritia.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Avaritia.java index c6f6006be..41058d331 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Avaritia.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/avaritia/Avaritia.java @@ -6,5 +6,4 @@ public class Avaritia extends GroovyPropertyContainer { public final ExtremeCrafting extremeCrafting = new ExtremeCrafting(); public final Compressor compressor = new Compressor(); - } 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 b1d8c36ba..0ddf0b589 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 @@ -89,7 +89,9 @@ public class RecipeBuilder extends AbstractRecipeBuilder { private int inputCount = 300; @Override - @RecipeBuilderMethodDescription(field = {"input", "inputCount"}) + @RecipeBuilderMethodDescription(field = { + "input", "inputCount" + }) public AbstractRecipeBuilder input(IIngredient ingredient) { if (ingredient == null) return this; if (ingredient.getAmount() > 1) { 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 b28cfaa14..968a2d452 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 @@ -26,7 +26,8 @@ public String getRecipeNamePrefix() { @Override @RecipeBuilderRegistrationMethod(hierarchy = 5) public IExtremeRecipe register() { - GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Extended Crafting Table recipe").error() + GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Extended Crafting Table recipe") + .error() .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!"); if (msg.postIfNotEmpty()) return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilCrafting.java index 936d33da0..b7e7fca77 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilCrafting.java @@ -64,5 +64,4 @@ public boolean removeByInput(IIngredient input) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilRecipeBuilder.java index 13e6d9a62..85d285491 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/AnvilRecipeBuilder.java @@ -23,7 +23,8 @@ public Shaped() { @Override @RecipeBuilderRegistrationMethod public IRecipe register() { - GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Better With Mods Anvil recipe").error() + GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Better With Mods Anvil recipe") + .error() .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!"); if (msg.postIfNotEmpty()) return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/BetterWithMods.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/BetterWithMods.java index f2033d46c..ca3afc008 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/BetterWithMods.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/BetterWithMods.java @@ -14,5 +14,4 @@ public class BetterWithMods extends GroovyPropertyContainer { public final Heat heat = new Heat(); public final Hopper hopper = new Hopper(); public final HopperFilters hopperFilters = new HopperFilters(); - } 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 d415d14b5..949bfac1d 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 @@ -22,7 +22,7 @@ public class Cauldron extends StandardListRegistry { @Example(".input(item('minecraft:clay')).output(item('minecraft:diamond')).heat(2)"), @Example(".input(item('minecraft:diamond')).output(item('minecraft:gold_ingot') * 16).ignoreHeat()") }) - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -118,5 +118,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 aaf8b8677..04bf83028 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 @@ -24,7 +24,7 @@ public class Crucible extends StandardListRegistry { @Example(".input(item('minecraft:clay')).output(item('minecraft:diamond')).heat(2)"), @Example(".input(item('minecraft:diamond')).output(item('minecraft:gold_ingot') * 16).ignoreHeat()") }) - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -123,5 +123,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 4d3e5a5ba..31d5991cb 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 @@ -108,5 +108,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 c3e097262..5dc16226c 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 @@ -138,5 +138,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 a6522858e..2257f1036 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 @@ -144,5 +144,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 3ae30ee25..c906884ea 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,5 +130,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 681e6afe6..b485982a6 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 @@ -19,7 +19,7 @@ public class Saw extends StandardListRegistry { @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond_block')).output(item('minecraft:gold_ingot') * 16)")) - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -119,5 +119,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 d8836bda5..4f74b95c2 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 @@ -140,5 +140,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 c3db6e1f6..cf1a554f5 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 @@ -1,6 +1,5 @@ package com.cleanroommc.groovyscript.compat.mods.bloodmagic; -import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable; import com.cleanroommc.groovyscript.api.GroovyLog; @@ -20,10 +19,11 @@ import java.util.Collections; @RegistryDescription( - admonition = @Admonition(type = Admonition.Type.DANGER, - format = Admonition.Format.STANDARD, - hasTitle = true, - value = "groovyscript.wiki.bloodmagic.alchemy_table.note0") + admonition = @Admonition( + type = Admonition.Type.DANGER, + format = Admonition.Format.STANDARD, + hasTitle = true, + value = "groovyscript.wiki.bloodmagic.alchemy_table.note0") ) public class AlchemyTable extends StandardListRegistry { 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 c67302f4c..140963190 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 @@ -19,10 +19,11 @@ @RegistryDescription( admonition = { @Admonition("groovyscript.wiki.bloodmagic.blood_altar.note0"), - @Admonition(value = "groovyscript.wiki.bloodmagic.blood_altar.note1", - type = Admonition.Type.DANGER, - format = Admonition.Format.STANDARD, - hasTitle = true) + @Admonition( + value = "groovyscript.wiki.bloodmagic.blood_altar.note1", + type = Admonition.Type.DANGER, + format = Admonition.Format.STANDARD, + hasTitle = true) } ) public class BloodAltar extends StandardListRegistry { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodMagic.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodMagic.java index 06af2a84e..db3de3f86 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodMagic.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodMagic.java @@ -11,5 +11,4 @@ public class BloodMagic extends GroovyPropertyContainer { public final Tranquility tranquility = new Tranquility(); public final Sacrificial sacrificial = new Sacrificial(); public final Meteor meteor = new Meteor(); - } 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 18008c2b0..7c4f94cc8 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 @@ -59,11 +59,15 @@ public boolean removeByOutput(IIngredient output) { @MethodDescription(example = @Example("ore('runeFireB')")) public boolean removeByInput(IIngredient... inputs) { - List converted = Arrays.stream(inputs).map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).collect(Collectors.toList()); + List converted = Arrays.stream(inputs) + .map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() : i.getMatchingStacks()[0]) + .collect(Collectors.toList()); if (getRecipes().removeIf(recipe -> { - boolean found = converted.stream().allMatch(o -> recipe.getInputs().stream().anyMatch(i -> o instanceof String || i instanceof String ? o.equals(i) - : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); + boolean found = converted.stream() + .allMatch( + o -> recipe.getInputs() + .stream() + .anyMatch(i -> o instanceof String || i instanceof String ? o.equals(i) : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); if (found) addBackup(recipe); return found; })) return true; @@ -105,8 +109,14 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable RecipePetals register() { if (!validate()) return null; - RecipePetals recipe = new RecipePetals(output.get(0), input.stream().map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).toArray()); + RecipePetals recipe = new RecipePetals( + output.get(0), + input.stream() + .map( + i -> i instanceof OreDictIngredient + ? ((OreDictIngredient) i).getOreDict() + : i.getMatchingStacks()[0]) + .toArray()); add(recipe); return recipe; } 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 0bff41c3d..1a730a4a6 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 @@ -182,7 +182,5 @@ public vazkii.botania.api.brew.Brew register() { ModSupport.BOTANIA.get().brew.add(brew); return brew; } - } - } 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 6f1cd5157..6953d4128 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 @@ -51,12 +51,15 @@ public boolean removeByOutput(vazkii.botania.api.brew.Brew brew) { @MethodDescription(example = @Example("item('minecraft:iron_ingot')")) public boolean removeByInput(IIngredient... inputs) { - List converted = Arrays.stream(inputs).map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).collect(Collectors.toList()); + List converted = Arrays.stream(inputs) + .map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() : i.getMatchingStacks()[0]) + .collect(Collectors.toList()); if (getRecipes().removeIf(recipe -> { - boolean found = converted.stream().allMatch(o -> recipe.getInputs().stream().anyMatch(i -> (i instanceof String || o instanceof String) - ? i.equals(o) - : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); + boolean found = converted.stream() + .allMatch( + o -> recipe.getInputs() + .stream() + .anyMatch(i -> (i instanceof String || o instanceof String) ? i.equals(o) : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); if (found) addBackup(recipe); return found; })) return true; @@ -106,11 +109,16 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable RecipeBrew register() { if (!validate()) return null; - RecipeBrew recipe = new RecipeBrew(brew, input.stream().map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).toArray()); + RecipeBrew recipe = new RecipeBrew( + brew, + input.stream() + .map( + i -> i instanceof OreDictIngredient + ? ((OreDictIngredient) i).getOreDict() + : i.getMatchingStacks()[0]) + .toArray()); add(recipe); return recipe; } } - } 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 d6e80f4a0..ecd2a02a8 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 @@ -29,8 +29,12 @@ public Collection getRecipes() { } protected Object[] convertIngredients(IIngredient[] inputs) { - return Arrays.stream(inputs).map(input -> input instanceof OreDictIngredient ? ((OreDictIngredient) input).getOreDict() - : input.getMatchingStacks()[0]).toArray(); + return Arrays.stream(inputs) + .map( + input -> input instanceof OreDictIngredient + ? ((OreDictIngredient) input).getOreDict() + : input.getMatchingStacks()[0]) + .toArray(); } @MethodDescription(type = MethodDescription.Type.ADDITION) @@ -73,8 +77,12 @@ public boolean removeByInputs(IIngredient... inputs) { List converted = Arrays.asList(convertIngredients(inputs)); List list = Arrays.asList(inputs); if (getRecipes().removeIf(recipe -> { - boolean found = recipe.getInputs().stream().allMatch(input -> input instanceof String ? converted.contains(input) - : list.stream().anyMatch(i -> i.test((ItemStack) input))); + boolean found = recipe.getInputs() + .stream() + .allMatch( + input -> input instanceof String + ? converted.contains(input) + : list.stream().anyMatch(i -> i.test((ItemStack) input))); if (found) addBackup(recipe); return found; })) return true; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/InfoParserBrew.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/InfoParserBrew.java index 800540068..d4667f323 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/InfoParserBrew.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/InfoParserBrew.java @@ -39,5 +39,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), brew, info.isPrettyNbt()); InfoParserTranslationKey.instance.add(info.getMessages(), brew.getUnlocalizedName(), info.isPrettyNbt()); } - } 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 17d9a3b01..bb1e2dddb 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 @@ -76,7 +76,6 @@ public boolean removeCategory(String name) { public SimpleObjectStream streamCategories() { return streamRecipes(); } - } @RegistryDescription( 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 31497851d..ee4a5035c 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 @@ -52,8 +52,9 @@ public boolean removeByOutput(ItemStack output) { @MethodDescription(example = @Example("item('minecraft:ender_pearl')")) public boolean removeByInput(IIngredient input) { if (getRecipes().removeIf(recipe -> { - boolean found = recipe.getInput() instanceof ItemStack ? input.test((ItemStack) recipe.getInput()) - : (input instanceof OreDictIngredient && ((OreDictIngredient) input).getOreDict().equals(recipe.getInput())); + boolean found = recipe.getInput() instanceof ItemStack + ? input.test((ItemStack) recipe.getInput()) + : (input instanceof OreDictIngredient && ((OreDictIngredient) input).getOreDict().equals(recipe.getInput())); if (found) addBackup(recipe); return found; })) return true; @@ -133,9 +134,10 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable RecipeManaInfusion register() { if (!validate()) return null; - RecipeManaInfusion recipe = new RecipeManaInfusion(output.get(0), - input.get(0) instanceof OreDictIngredient ? ((OreDictIngredient) input.get(0)).getOreDict() - : input.get(0).getMatchingStacks()[0], mana); + RecipeManaInfusion recipe = new RecipeManaInfusion( + output.get(0), + input.get(0) instanceof OreDictIngredient ? ((OreDictIngredient) input.get(0)).getOreDict() : input.get(0).getMatchingStacks()[0], + mana); if (catalyst != null) recipe.setCatalyst(catalyst); add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Orechid.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Orechid.java index fcf3ae3b3..0c00bf079 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Orechid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Orechid.java @@ -37,7 +37,9 @@ public OrechidRecipe add(String output, int weight) { return recipe; } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = {@Example("ore('oreEmerald'), 1350"), @Example("ore('blockGold'), 1800")}) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = { + @Example("ore('oreEmerald'), 1350"), @Example("ore('blockGold'), 1800") + }) public OrechidRecipe add(OreDictIngredient output, int weight) { return add(output.getOreDict(), weight); } @@ -73,7 +75,9 @@ public boolean removeByOutput(String output) { return false; } - @MethodDescription(example = {@Example(value = "ore('oreEmerald')", commented = true), @Example(value = "ore('oreQuartz')", commented = true)}) + @MethodDescription(example = { + @Example(value = "ore('oreEmerald')", commented = true), @Example(value = "ore('oreQuartz')", commented = true) + }) public boolean removeByOutput(OreDictIngredient output) { return removeByOutput(output.getOreDict()); } 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 de28efa80..2fdf31ac9 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 @@ -53,12 +53,15 @@ public boolean removeByOutput(IIngredient output) { @MethodDescription(example = @Example("ore('runeEarthB')")) public boolean removeByInput(IIngredient... inputs) { - List converted = Arrays.stream(inputs).map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).collect(Collectors.toList()); + List converted = Arrays.stream(inputs) + .map(i -> i instanceof OreDictIngredient ? ((OreDictIngredient) i).getOreDict() : i.getMatchingStacks()[0]) + .collect(Collectors.toList()); if (getRecipes().removeIf(recipe -> { - boolean found = converted.stream().allMatch(o -> recipe.getInputs().stream().anyMatch(i -> (i instanceof String || o instanceof String) - ? i.equals(o) - : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); + boolean found = converted.stream() + .allMatch( + o -> recipe.getInputs() + .stream() + .anyMatch(i -> (i instanceof String || o instanceof String) ? i.equals(o) : ItemStack.areItemStacksEqual((ItemStack) i, (ItemStack) o))); if (found) addBackup(recipe); return found; })) return true; @@ -103,7 +106,8 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateFluids(msg); validateItems(msg, 1, 20, 1, 1); - msg.add(input.stream().anyMatch(x -> x.test(new ItemStack(Item.getItemFromBlock(ModBlocks.livingrock), 1, 0))), + msg.add( + input.stream().anyMatch(x -> x.test(new ItemStack(Item.getItemFromBlock(ModBlocks.livingrock), 1, 0))), "input cannot contain a livingrock item"); msg.add(mana < 1, "mana must be at least 1, got " + mana); } @@ -112,9 +116,15 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable RecipeRuneAltar register() { if (!validate()) return null; - RecipeRuneAltar recipe = new RecipeRuneAltar(output.get(0), mana, input.stream().map(i -> i instanceof OreDictIngredient - ? ((OreDictIngredient) i).getOreDict() - : i.getMatchingStacks()[0]).toArray()); + RecipeRuneAltar recipe = new RecipeRuneAltar( + output.get(0), + mana, + input.stream() + .map( + i -> i instanceof OreDictIngredient + ? ((OreDictIngredient) i).getOreDict() + : i.getMatchingStacks()[0]) + .toArray()); add(recipe); return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java index 8f281ce3b..948b6e888 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/AgglomerationPlate.java @@ -10,7 +10,6 @@ import com.google.common.collect.ImmutableList; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipe; import quaternary.botaniatweaks.modules.botania.recipe.AgglomerationRecipes; @@ -117,14 +116,18 @@ public RecipeBuilder colorEnd(int colorEnd) { return this; } - @RecipeBuilderMethodDescription(field = {"colorStart", "colorEnd"}) + @RecipeBuilderMethodDescription(field = { + "colorStart", "colorEnd" + }) public RecipeBuilder color(int colorStart, int colorEnd) { this.colorStart = colorStart; this.colorEnd = colorEnd; return this; } - @RecipeBuilderMethodDescription(field = {"center", "edge", "corner"}) + @RecipeBuilderMethodDescription(field = { + "center", "edge", "corner" + }) public RecipeBuilder baseStructure() { this.center = ModBlocks.livingrock.getDefaultState(); this.edge = Objects.requireNonNull(Blocks.LAPIS_BLOCK).getDefaultState(); @@ -197,7 +200,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.BOTANIA_TWEAKS.get().agglomerationPlate.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/BotaniaTweaks.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/BotaniaTweaks.java index fb197ca2c..7f1a538ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/BotaniaTweaks.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botaniatweaks/BotaniaTweaks.java @@ -5,5 +5,4 @@ public class BotaniaTweaks extends GroovyPropertyContainer { public final AgglomerationPlate agglomerationPlate = new AgglomerationPlate(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/BotanicAdditions.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/BotanicAdditions.java index dbf042726..e9b7facd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/BotanicAdditions.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/BotanicAdditions.java @@ -5,5 +5,4 @@ public class BotanicAdditions extends GroovyPropertyContainer { public final GaiaPlate gaiaPlate = new GaiaPlate(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/GaiaPlate.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/GaiaPlate.java index 039aa924c..1f131460c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/GaiaPlate.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botanicadditions/GaiaPlate.java @@ -45,8 +45,7 @@ public boolean removeByOutput(IIngredient output) { public boolean removeByInput(IIngredient input) { return getRecipes().removeIf(r -> { for (Object ingredient : r.getInputs()) { - if ((ingredient instanceof String s && (input instanceof OreDictIngredient ore && ore.getOreDict().equals(s) || OreDictionary.getOres(s, false).stream().anyMatch(input))) || - (ingredient instanceof ItemStack is && input.test(is))) { + if ((ingredient instanceof String s && (input instanceof OreDictIngredient ore && ore.getOreDict().equals(s) || OreDictionary.getOres(s, false).stream().anyMatch(input))) || (ingredient instanceof ItemStack is && input.test(is))) { addBackup(r); return true; } @@ -92,5 +91,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/Calculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/Calculator.java index c05681afd..a0890dfe3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/Calculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/Calculator.java @@ -59,5 +59,4 @@ public static List toSonarRecipeObjectList(IngredientList specialOutput = new ArrayList<>(); specialOutput.add(output.get(0)); - specialOutput.add(new ExtractionChamberRecipes.ExtractionChamberOutput(new ItemStack( - isDamaged ? sonar.calculator.mod.Calculator.circuitDamaged : sonar.calculator.mod.Calculator.circuitDirty, 1, 32767))); + specialOutput.add( + new ExtractionChamberRecipes.ExtractionChamberOutput( + new ItemStack( + isDamaged ? sonar.calculator.mod.Calculator.circuitDamaged : sonar.calculator.mod.Calculator.circuitDirty, + 1, + 32767))); CalculatorRecipe recipe = ExtractionChamberRecipes.instance() .buildDefaultRecipe(Calculator.toSonarRecipeObjectList(input), specialOutput, new ArrayList<>(), false); 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 ef20b0afc..15c7a2659 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 @@ -57,14 +57,17 @@ public void onReload() { }); } - @MethodDescription(example = {@Example("'demo', item('minecraft:diamond_block')"), - @Example("'demo', item('chisel:antiblock:3')"), - @Example("'demo', item('minecraft:sea_lantern')")}, type = MethodDescription.Type.ADDITION) + @MethodDescription(example = { + @Example("'demo', item('minecraft:diamond_block')"), + @Example("'demo', item('chisel:antiblock:3')"), + @Example("'demo', item('minecraft:sea_lantern')") + }, type = MethodDescription.Type.ADDITION) public void addVariation(String groupName, ItemStack item) { if (IngredientHelper.overMaxSize(item, 1)) { - GroovyLog.msg("Error adding Chisel Carving").error() - .add("Item must have stack size of 1, got {}", item.getCount()) - .post(); + GroovyLog.msg("Error adding Chisel Carving") + .error() + .add("Item must have stack size of 1, got {}", item.getCount()) + .post(); return; } try { @@ -79,7 +82,9 @@ public void addVariation(String groupName, ItemStack item) { } } - @MethodDescription(example = {@Example("'antiblock', item('chisel:antiblock:3')"), @Example("'antiblock', item('chisel:antiblock:15')")}) + @MethodDescription(example = { + @Example("'antiblock', item('chisel:antiblock:3')"), @Example("'antiblock', item('chisel:antiblock:15')") + }) public void removeVariation(String groupName, ItemStack item) { try { getRegistry().removeVariation(item, groupName); @@ -199,5 +204,4 @@ public CarvingGroup remove(Collection items) { return this; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Chisel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Chisel.java index a3873ec1b..0961a8f1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Chisel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Chisel.java @@ -5,5 +5,4 @@ public class Chisel extends GroovyPropertyContainer { public final Carving carving = new Carving(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/CompactMachines.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/CompactMachines.java index fbcfac0d6..4c0a8ceeb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/CompactMachines.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/CompactMachines.java @@ -5,5 +5,4 @@ public class CompactMachines extends GroovyPropertyContainer { public final Miniaturization miniaturization = new Miniaturization(); - } 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 fb464fe3b..7925d828f 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 @@ -164,7 +164,8 @@ public void validate(GroovyLog.Msg msg) { for (String error : errors) { msg.add(error); } - String missingKeys = shape.stream().flatMap(l -> l.stream().flatMap(g -> Arrays.stream(g.split("")).map(q -> q.charAt(0)))) + String missingKeys = shape.stream() + .flatMap(l -> l.stream().flatMap(g -> Arrays.stream(g.split("")).map(q -> q.charAt(0)))) .distinct() .filter(x -> !(keyMap.containsKey(x) || x == ' ' || x == '_')) .map(String::valueOf) @@ -188,8 +189,12 @@ public org.dave.compactmachines3.miniaturization.MultiblockRecipe register() { ticks ); - String[][][] target = shape.stream().map(l -> l.stream().map(g -> g.replace(" ", "_").split("")) - .toArray(String[][]::new)).toArray(String[][][]::new); + String[][][] target = shape.stream() + .map( + l -> l.stream() + .map(g -> g.replace(" ", "_").split("")) + .toArray(String[][]::new)) + .toArray(String[][][]::new); recipe.setPositionMap(target); @@ -234,9 +239,6 @@ public boolean isIgnoreMeta() { public ItemStack getReference() { return reference; } - } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Cyclic.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Cyclic.java index 7f7a7e21e..daeb51f45 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Cyclic.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Cyclic.java @@ -9,5 +9,4 @@ public class Cyclic extends GroovyPropertyContainer { public final Melter melter = new Melter(); public final Packager packager = new Packager(); public final Solidifier solidifier = new Solidifier(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Hydrator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Hydrator.java index c11498768..88019142e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Hydrator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Hydrator.java @@ -1,7 +1,6 @@ package com.cleanroommc.groovyscript.compat.mods.cyclic; -import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Solidifier.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Solidifier.java index 8c5c20c05..2a5e82eb7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Solidifier.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/cyclic/Solidifier.java @@ -38,7 +38,9 @@ public Collection getRecipes() { return RecipeSolidifier.recipes; } - @MethodDescription(example = {@Example("item('minecraft:bucket')"), @Example("fluid('water')"),}) + @MethodDescription(example = { + @Example("item('minecraft:bucket')"), @Example("fluid('water')"), + }) public boolean removeByInput(IIngredient input) { return getRecipes().removeIf(recipe -> { if (input.test(recipe.getFluidIngredient()) || recipe.getRecipeInput().stream().anyMatch(input)) { 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 b0e7dbe83..75caec3c5 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 @@ -127,9 +127,7 @@ public void craft(IFusionCraftingInventory inventory, World world, BlockPos bloc } @Override - public void onCraftingTick(IFusionCraftingInventory iFusionCraftingInventory, World world, BlockPos blockPos) { - - } + public void onCraftingTick(IFusionCraftingInventory iFusionCraftingInventory, World world, BlockPos blockPos) {} @Override public String canCraft(IFusionCraftingInventory inventory, World world, BlockPos blockPos) { 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 2777fe295..5caa6fbf1 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 @@ -142,8 +142,7 @@ public void forBlock(BlockStates states, World world, BlockPos pos, BlockPos sta if (states == null) return; - if (states.isWildcard() || - states.equals(coreBlock())) + if (states.isWildcard() || states.equals(coreBlock())) return; //region Render Build Guide diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockHelper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockHelper.java index 76351e5dd..cf426dbb4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStateMultiblockHelper.java @@ -17,7 +17,8 @@ public void setBlock(BlockStates states, World world, BlockPos pos) { } } - @SuppressWarnings({"unused", "EmptyMethod"}) - public void forBlock(BlockStates state, World world, BlockPos pos, BlockPos startPos, int flag) { - } + @SuppressWarnings({ + "unused", "EmptyMethod" + }) + public void forBlock(BlockStates state, World world, BlockPos pos, BlockPos startPos, int flag) {} } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStates.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStates.java index 38f9c137e..a60957483 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStates.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/draconicevolution/helpers/BlockStates.java @@ -16,6 +16,7 @@ public class BlockStates { public static final BlockStates ANY = new BlockStates(null) { + @Override public boolean matches(IBlockState state, boolean wildCardAir) { if (wildCardAir) return state.getBlock().equals(Blocks.AIR); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/AlloySmelter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/AlloySmelter.java index a855d6d93..145a6260c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/AlloySmelter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/AlloySmelter.java @@ -118,17 +118,14 @@ public List find(ItemStack output) { private void removeInternal(Collection recipes) { AlloyRecipeManagerAccessor accessor = (AlloyRecipeManagerAccessor) AlloyRecipeManager.getInstance(); @SuppressWarnings("unchecked") - Int2ObjectOpenHashMap, ItemRecipeNode>>> map = - ((ItemRecipeNodeAccessor>>) - ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); + Int2ObjectOpenHashMap, ItemRecipeNode>>> map = ((ItemRecipeNodeAccessor>>) ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); for (NNPair, ItemRecipeNode>> pair : map.values()) { Iterator listIter = pair.left.iterator(); while (listIter.hasNext()) { if (recipes.contains(listIter.next())) { listIter.remove(); @SuppressWarnings("unchecked") - Int2ObjectOpenHashMap, ItemRecipeLeafNode>> nestedMap = - ((ItemRecipeNodeAccessor>) pair.right).getMap(); + Int2ObjectOpenHashMap, ItemRecipeLeafNode>> nestedMap = ((ItemRecipeNodeAccessor>) pair.right).getMap(); for (NNPair, ItemRecipeLeafNode> nestedPair : nestedMap.values()) { Iterator nestedListIter = nestedPair.left.iterator(); while (nestedListIter.hasNext()) { @@ -149,9 +146,12 @@ private void removeInternal(Collection recipes) { @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { - List list = MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.ALLOYSMELTER).values().stream() + List list = MachineRecipeRegistry.instance.getRecipesForMachine(MachineRecipeRegistry.ALLOYSMELTER) + .values() + .stream() .filter(r -> r instanceof IManyToOneRecipe) - .map(r -> (IManyToOneRecipe) r).collect(Collectors.toList()); + .map(r -> (IManyToOneRecipe) r) + .collect(Collectors.toList()); return new SimpleObjectStream<>(list) .setRemover(this::remove); } @@ -160,9 +160,7 @@ public SimpleObjectStream streamRecipes() { public void removeAll() { AlloyRecipeManagerAccessor accessor = (AlloyRecipeManagerAccessor) AlloyRecipeManager.getInstance(); @SuppressWarnings("unchecked") - Int2ObjectOpenHashMap, ItemRecipeNode>>> map = - ((ItemRecipeNodeAccessor>>) - ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); + Int2ObjectOpenHashMap, ItemRecipeNode>>> map = ((ItemRecipeNodeAccessor>>) ((TriItemLookupAccessor) accessor.getLookup()).getRoot()).getMap(); for (NNPair, ItemRecipeNode>> pair : map.values()) { Iterator listIter = pair.left.iterator(); while (listIter.hasNext()) { @@ -209,5 +207,4 @@ public void validate(GroovyLog.Msg msg) { return null; } } - } 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 15c7eb7b0..f57907e03 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 @@ -149,7 +149,8 @@ public RecipeBuilder customLapis(IIngredient lapis) { @Override public boolean validate() { - GroovyLog.Msg msg = GroovyLog.msg("Error adding EnderIO Enchanter recipe").error() + GroovyLog.Msg msg = GroovyLog.msg("Error adding EnderIO Enchanter recipe") + .error() .add(enchantment == null, () -> "enchantment must not be null") .add(IngredientHelper.isEmpty(input), () -> "input must not be empty") .add(IngredientHelper.isEmpty(book), () -> "custom book must not be empty") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/EnderIO.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/EnderIO.java index b4fe0ee75..431aacbd0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/EnderIO.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/EnderIO.java @@ -14,5 +14,4 @@ public class EnderIO extends GroovyPropertyContainer { public final SoulBinder soulBinder = new SoulBinder(); public final Tank tank = new Tank(); public final Vat vat = new Vat(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidCoolant.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidCoolant.java index 2e97683ed..f15e7a91f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidCoolant.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidCoolant.java @@ -112,5 +112,4 @@ public void removeAll() { }); ((FluidFuelRegisterAccessor) FluidFuelRegister.instance).getCoolants().clear(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidFuel.java index 11d414b80..cbcdc9a96 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/FluidFuel.java @@ -107,5 +107,4 @@ public void removeAll() { }); ((FluidFuelRegisterAccessor) FluidFuelRegister.instance).getFuels().clear(); } - } 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 24c372e94..9bc84d1f7 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 @@ -65,7 +65,9 @@ public static class RecipeBuilder extends EnderIORecipeBuilder { @Property(defaultValue = "RecipeBonusType.NONE") private RecipeBonusType bonusType = RecipeBonusType.NONE; - @RecipeBuilderMethodDescription(field = {"output", "chances"}) + @RecipeBuilderMethodDescription(field = { + "output", "chances" + }) public RecipeBuilder output(ItemStack itemStack, float chance) { this.output.add(itemStack); this.chances.add(Math.max(0, chance)); @@ -73,7 +75,9 @@ public RecipeBuilder output(ItemStack itemStack, float chance) { } @Override - @RecipeBuilderMethodDescription(field = {"output", "chances"}) + @RecipeBuilderMethodDescription(field = { + "output", "chances" + }) public AbstractRecipeBuilder output(ItemStack output) { return output(output, 1.0f); } 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 74e1ade9d..b27b109be 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 @@ -242,8 +242,7 @@ public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 1); if (isFilling) validateFluids(msg, 0, 0, 1, 1); else validateFluids(msg, 1, 1, 0, 0); - msg.add(msg.hasSubMessages(), "The Tank Recipe Builder requires an input fluid stack if it is draining and " + - "an output fluid stack if it is filling. This recipe was {}.", isFilling ? "filling" : "draining"); + msg.add(msg.hasSubMessages(), "The Tank Recipe Builder requires an input fluid stack if it is draining and " + "an output fluid stack if it is filling. This recipe was {}.", isFilling ? "filling" : "draining"); } @Override @@ -252,8 +251,14 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; Things in = RecipeUtils.toThings(input.get(0)); Things out = new Things().add(output.getOrEmpty(0)); - TankMachineRecipe recipe = new TankMachineRecipe(super.name.toString(), isFilling, in, isFilling ? fluidOutput.get(0) - : fluidInput.get(0), out, TankMachineRecipe.Logic.NONE, RecipeLevel.IGNORE); + TankMachineRecipe recipe = new TankMachineRecipe( + super.name.toString(), + isFilling, + in, + isFilling ? fluidOutput.get(0) : fluidInput.get(0), + out, + TankMachineRecipe.Logic.NONE, + RecipeLevel.IGNORE); ModSupport.ENDER_IO.get().tank.add(recipe); return recipe; 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 517d4fa12..85805cb17 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 @@ -125,14 +125,18 @@ public RecipeBuilder baseMultiplier(float baseMultiplier) { return this; } - @RecipeBuilderMethodDescription(field = {"itemInputs1", "multipliers1"}) + @RecipeBuilderMethodDescription(field = { + "itemInputs1", "multipliers1" + }) public RecipeBuilder itemInputLeft(IIngredient ingredient, float multiplier) { itemInputs1.add(ingredient); multipliers1.add(multiplier); return this; } - @RecipeBuilderMethodDescription(field = {"itemInputs2", "multipliers2"}) + @RecipeBuilderMethodDescription(field = { + "itemInputs2", "multipliers2" + }) public RecipeBuilder itemInputRight(IIngredient ingredient, float multiplier) { itemInputs2.add(ingredient); multipliers2.add(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 4ab7bdb1c..1f12df67a 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 @@ -49,7 +49,6 @@ public boolean isRecipe(@NotNull RecipeLevel machineLevel, @NotNull NNList extends AbstractRecipeBuilder { - @Property(value = "groovyscript.wiki.enderio.level.value", needsOverride = true,defaultValue = "RecipeLevel.IGNORE", hierarchy = 20) + @Property(value = "groovyscript.wiki.enderio.level.value", needsOverride = true, defaultValue = "RecipeLevel.IGNORE", hierarchy = 20) protected RecipeLevel level = RecipeLevel.IGNORE; @Property(value = "groovyscript.wiki.enderio.energy.value", needsOverride = true, hierarchy = 20) protected int energy; 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 f03a521fc..503c78358 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 @@ -90,5 +90,4 @@ public void shrinkStack(int count) { public int getStackSize() { return ing.getAmount(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/DemonTradeManager.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/DemonTradeManager.java index e81393d46..5ad691057 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/DemonTradeManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/DemonTradeManager.java @@ -1,92 +1,92 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; -import com.cleanroommc.groovyscript.api.documentation.annotations.Example; -import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; -import com.cleanroommc.groovyscript.helper.Alias; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import essentialcraft.api.DemonTrade; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.registry.EntityEntry; - -@RegistryDescription( - category = RegistryDescription.Category.ENTRIES, - admonition = @Admonition(value = "groovyscript.wiki.essentialcraft.demon_trade.note0", type = Admonition.Type.DANGER)) -public class DemonTradeManager extends VirtualizedRegistry { - - public DemonTradeManager() { - super(Alias.generateOf("DemonTrade")); - } - - @Override - public void onReload() { - removeScripted().forEach(DemonTrade::removeTrade); - restoreFromBackup().forEach(r -> { - DemonTrade.TRADES.add(r); - if (r.desiredItem.isEmpty()) { - DemonTrade.ALL_MOBS.add(r.entityType); - } - }); - } - - @MethodDescription(example = @Example("item('minecraft:diamond')"), type = MethodDescription.Type.ADDITION) - public void add(IIngredient x) { - for (ItemStack it : x.getMatchingStacks()) { - DemonTrade t = new DemonTrade(it); // this automatically registers the trade - addScripted(t); - } - } - - @MethodDescription(example = @Example("entity('minecraft:chicken')"), type = MethodDescription.Type.ADDITION) - public void add(EntityEntry x) { - DemonTrade t = new DemonTrade(x); // this automatically registers the trade - addScripted(t); - } - - @MethodDescription(example = @Example("item('minecraft:nether_star')")) - public boolean remove(IIngredient x) { - return DemonTrade.TRADES.removeIf(r -> { - if (!r.desiredItem.isEmpty() && x.test(r.desiredItem)) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(description = "groovyscript.wiki.essentialcraft.demon_trade.removeEntity", example = @Example("entity('minecraft:enderman')")) - public boolean remove(EntityEntry x) { - return DemonTrade.TRADES.removeIf(r -> { - if (r.desiredItem.isEmpty() && x.equals(r.entityType)) { - addBackup(r); - DemonTrade.ALL_MOBS.remove(r.entityType); - return true; - } - return false; - }); - } - - private boolean remove(DemonTrade t) { - if (DemonTrade.TRADES.stream().anyMatch(r -> r.equals(t))) { - addBackup(t); - DemonTrade.removeTrade(t); - return true; - } - return false; - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - DemonTrade.TRADES.forEach(this::addBackup); - DemonTrade.TRADES.clear(); - DemonTrade.ALL_MOBS.clear(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(DemonTrade.TRADES).setRemover(this::remove); - } -} \ No newline at end of file +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import essentialcraft.api.DemonTrade; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.EntityEntry; + +@RegistryDescription( + category = RegistryDescription.Category.ENTRIES, + admonition = @Admonition(value = "groovyscript.wiki.essentialcraft.demon_trade.note0", type = Admonition.Type.DANGER)) +public class DemonTradeManager extends VirtualizedRegistry { + + public DemonTradeManager() { + super(Alias.generateOf("DemonTrade")); + } + + @Override + public void onReload() { + removeScripted().forEach(DemonTrade::removeTrade); + restoreFromBackup().forEach(r -> { + DemonTrade.TRADES.add(r); + if (r.desiredItem.isEmpty()) { + DemonTrade.ALL_MOBS.add(r.entityType); + } + }); + } + + @MethodDescription(example = @Example("item('minecraft:diamond')"), type = MethodDescription.Type.ADDITION) + public void add(IIngredient x) { + for (ItemStack it : x.getMatchingStacks()) { + DemonTrade t = new DemonTrade(it); // this automatically registers the trade + addScripted(t); + } + } + + @MethodDescription(example = @Example("entity('minecraft:chicken')"), type = MethodDescription.Type.ADDITION) + public void add(EntityEntry x) { + DemonTrade t = new DemonTrade(x); // this automatically registers the trade + addScripted(t); + } + + @MethodDescription(example = @Example("item('minecraft:nether_star')")) + public boolean remove(IIngredient x) { + return DemonTrade.TRADES.removeIf(r -> { + if (!r.desiredItem.isEmpty() && x.test(r.desiredItem)) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(description = "groovyscript.wiki.essentialcraft.demon_trade.removeEntity", example = @Example("entity('minecraft:enderman')")) + public boolean remove(EntityEntry x) { + return DemonTrade.TRADES.removeIf(r -> { + if (r.desiredItem.isEmpty() && x.equals(r.entityType)) { + addBackup(r); + DemonTrade.ALL_MOBS.remove(r.entityType); + return true; + } + return false; + }); + } + + private boolean remove(DemonTrade t) { + if (DemonTrade.TRADES.stream().anyMatch(r -> r.equals(t))) { + addBackup(t); + DemonTrade.removeTrade(t); + return true; + } + return false; + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + DemonTrade.TRADES.forEach(this::addBackup); + DemonTrade.TRADES.clear(); + DemonTrade.ALL_MOBS.clear(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(DemonTrade.TRADES).setRemover(this::remove); + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/EssentialCraft.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/EssentialCraft.java index 172955437..f1430f679 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/EssentialCraft.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/EssentialCraft.java @@ -1,13 +1,13 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; - -public class EssentialCraft extends GroovyPropertyContainer { - - public final DemonTradeManager demonTrade = new DemonTradeManager(); - public final MagicianTable magicianTable = new MagicianTable(); - public final MagmaticSmeltery magmaticSmeltery = new MagmaticSmeltery(); - public final MithrilineFurnace mithrilineFurnace = new MithrilineFurnace(); - public final RadiatingChamber radiatingChamber = new RadiatingChamber(); - public final WindRune windRune = new WindRune(); -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; + +public class EssentialCraft extends GroovyPropertyContainer { + + public final DemonTradeManager demonTrade = new DemonTradeManager(); + public final MagicianTable magicianTable = new MagicianTable(); + public final MagmaticSmeltery magmaticSmeltery = new MagmaticSmeltery(); + public final MithrilineFurnace mithrilineFurnace = new MithrilineFurnace(); + public final RadiatingChamber radiatingChamber = new RadiatingChamber(); + public final WindRune windRune = new WindRune(); +} 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 e28356d70..be1923c86 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 @@ -1,81 +1,81 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import essentialcraft.api.MagicianTableRecipe; -import essentialcraft.api.MagicianTableRecipes; -import net.minecraft.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; - -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.essentialcraft.magician_table.note0", type = Admonition.Type.WARNING)) -public class MagicianTable extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond'), ore('ingotGold'), ore('ingotGold'), ore('stickWood'), ore('stickWood')).output(item('minecraft:iron_ingot')).mru(500)")) - public MagicianTable.RecipeBuilder recipeBuilder() { - return new MagicianTable.RecipeBuilder(); - } - - @Override - public Collection getRecipes() { - return MagicianTableRecipes.RECIPES; - } - - @MethodDescription(example = @Example("item('essentialcraft:genitem')")) - public boolean removeByOutput(IIngredient x) { - return getRecipes().removeIf(r -> { - if (x.test(r.getRecipeOutput())) { - addBackup(r); - return true; - } - return false; - }); - } - - @Property(property = "input", comp = @Comp(gte = 1, lte = 5)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int mru; - - @RecipeBuilderMethodDescription - public RecipeBuilder mru(int cost) { - mru = cost; - return this; - } - - @Override - protected int getMaxItemInput() { - return 1; - } - - @Override - public String getErrorMsg() { - return "Error adding Magician Table Recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 5, 1, 1); - validateFluids(msg); - msg.add(mru < 1, "mru cost must be 1 or greater, got {}", mru); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable MagicianTableRecipe register() { - if (!validate()) return null; - Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); - MagicianTableRecipe recipe = new MagicianTableRecipe(inputIngredient, output.get(0), mru); - ModSupport.ESSENTIALCRAFT.get().magicianTable.addScripted(recipe); - MagicianTableRecipes.addRecipe(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import essentialcraft.api.MagicianTableRecipe; +import essentialcraft.api.MagicianTableRecipes; +import net.minecraft.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; + +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.essentialcraft.magician_table.note0", type = Admonition.Type.WARNING)) +public class MagicianTable extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond'), ore('ingotGold'), ore('ingotGold'), ore('stickWood'), ore('stickWood')).output(item('minecraft:iron_ingot')).mru(500)")) + public MagicianTable.RecipeBuilder recipeBuilder() { + return new MagicianTable.RecipeBuilder(); + } + + @Override + public Collection getRecipes() { + return MagicianTableRecipes.RECIPES; + } + + @MethodDescription(example = @Example("item('essentialcraft:genitem')")) + public boolean removeByOutput(IIngredient x) { + return getRecipes().removeIf(r -> { + if (x.test(r.getRecipeOutput())) { + addBackup(r); + return true; + } + return false; + }); + } + + @Property(property = "input", comp = @Comp(gte = 1, lte = 5)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int mru; + + @RecipeBuilderMethodDescription + public RecipeBuilder mru(int cost) { + mru = cost; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Magician Table Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 5, 1, 1); + validateFluids(msg); + msg.add(mru < 1, "mru cost must be 1 or greater, got {}", mru); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable MagicianTableRecipe register() { + if (!validate()) return null; + Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); + MagicianTableRecipe recipe = new MagicianTableRecipe(inputIngredient, output.get(0), mru); + ModSupport.ESSENTIALCRAFT.get().magicianTable.addScripted(recipe); + MagicianTableRecipes.addRecipe(recipe); + return recipe; + } + } +} 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 396b05870..5536fc9ac 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 @@ -1,133 +1,133 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import essentialcraft.api.OreSmeltingRecipe; -import org.jetbrains.annotations.Nullable; - -@RegistryDescription(reloadability = RegistryDescription.Reloadability.DISABLED, admonition = { - @Admonition(value = "groovyscript.wiki.essentialcraft.magmatic_smeltery.note0", type = Admonition.Type.WARNING), -}) -public class MagmaticSmeltery extends VirtualizedRegistry { - - @RecipeBuilderDescription(example = @Example(".input('blockIron').output('ingotGold').factor(3).color(0x0000ff)")) - public MagmaticSmeltery.RecipeBuilder recipeBuilder() { - return new MagmaticSmeltery.RecipeBuilder(); - } - - @Override - public void onReload() { - removeScripted().forEach(OreSmeltingRecipe::removeRecipe); - restoreFromBackup().forEach(OreSmeltingRecipe::register); - } - - @MethodDescription(example = @Example("ore('oreIron')")) - public boolean removeByInput(OreDictIngredient x) { - return removeByInput(x.getOreDict()); - } - - @MethodDescription(example = @Example("'oreDiamond'")) - public boolean removeByInput(String x) { - if (OreSmeltingRecipe.RECIPE_MAP.containsKey(x)) { - OreSmeltingRecipe recipe = OreSmeltingRecipe.RECIPE_MAP.get(x); - addBackup(recipe); - OreSmeltingRecipe.removeRecipe(recipe); - return true; - } - return false; - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - OreSmeltingRecipe.RECIPES.forEach(this::addBackup); - OreSmeltingRecipe.RECIPES.clear(); - OreSmeltingRecipe.RECIPE_MAP.clear(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(OreSmeltingRecipe.RECIPES).setRemover(r -> removeByInput(r.oreName)); - } - - public static class RecipeBuilder implements IRecipeBuilder { - - @Property(comp = @Comp(eq = 1)) - private String input; - - @Property(comp = @Comp(eq = 1)) - private String output; - - @Property(comp = @Comp(gte = 0, unique = "groovyscript.wiki.essentialcraft.magmatic_smeltery.color.required")) - private int color; - - @Property(comp = @Comp(gte = 1), defaultValue = "1") - private int factor = 1; - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder input(String input) { - this.input = input; - return this; - } - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder input(OreDictIngredient input) { - this.input = input.getOreDict(); - return this; - } - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder output(String output) { - this.output = output; - return this; - } - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder output(OreDictIngredient output) { - this.output = output.getOreDict(); - return this; - } - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder color(int color) { - this.color = color; - return this; - } - - @RecipeBuilderMethodDescription - public MagmaticSmeltery.RecipeBuilder factor(int factor) { - this.factor = factor; - return this; - } - - public String getErrorMsg() { - return "Error adding Magmatic Smeltery Recipe"; - } - - public void validate(GroovyLog.Msg msg) { - msg.add(OreSmeltingRecipe.RECIPE_MAP.containsKey(input), "This OreDict can already be processed in Magmatic Smeltery: {}", input); - msg.add(color < 0 || color >= (1 << 24), "color must be between 0 and 0xffffff, got {}", Integer.toHexString(color)); - } - - @Override - public boolean validate() { - GroovyLog.Msg msg = GroovyLog.msg(getErrorMsg()).error(); - validate(msg); - return !msg.postIfNotEmpty(); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable OreSmeltingRecipe register() { - if (!validate()) return null; - OreSmeltingRecipe recipe = new OreSmeltingRecipe(input, output, color, factor); - recipe.register(); - ModSupport.ESSENTIALCRAFT.get().magmaticSmeltery.addScripted(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import essentialcraft.api.OreSmeltingRecipe; +import org.jetbrains.annotations.Nullable; + +@RegistryDescription(reloadability = RegistryDescription.Reloadability.DISABLED, admonition = { + @Admonition(value = "groovyscript.wiki.essentialcraft.magmatic_smeltery.note0", type = Admonition.Type.WARNING), +}) +public class MagmaticSmeltery extends VirtualizedRegistry { + + @RecipeBuilderDescription(example = @Example(".input('blockIron').output('ingotGold').factor(3).color(0x0000ff)")) + public MagmaticSmeltery.RecipeBuilder recipeBuilder() { + return new MagmaticSmeltery.RecipeBuilder(); + } + + @Override + public void onReload() { + removeScripted().forEach(OreSmeltingRecipe::removeRecipe); + restoreFromBackup().forEach(OreSmeltingRecipe::register); + } + + @MethodDescription(example = @Example("ore('oreIron')")) + public boolean removeByInput(OreDictIngredient x) { + return removeByInput(x.getOreDict()); + } + + @MethodDescription(example = @Example("'oreDiamond'")) + public boolean removeByInput(String x) { + if (OreSmeltingRecipe.RECIPE_MAP.containsKey(x)) { + OreSmeltingRecipe recipe = OreSmeltingRecipe.RECIPE_MAP.get(x); + addBackup(recipe); + OreSmeltingRecipe.removeRecipe(recipe); + return true; + } + return false; + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + OreSmeltingRecipe.RECIPES.forEach(this::addBackup); + OreSmeltingRecipe.RECIPES.clear(); + OreSmeltingRecipe.RECIPE_MAP.clear(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(OreSmeltingRecipe.RECIPES).setRemover(r -> removeByInput(r.oreName)); + } + + public static class RecipeBuilder implements IRecipeBuilder { + + @Property(comp = @Comp(eq = 1)) + private String input; + + @Property(comp = @Comp(eq = 1)) + private String output; + + @Property(comp = @Comp(gte = 0, unique = "groovyscript.wiki.essentialcraft.magmatic_smeltery.color.required")) + private int color; + + @Property(comp = @Comp(gte = 1), defaultValue = "1") + private int factor = 1; + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder input(String input) { + this.input = input; + return this; + } + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder input(OreDictIngredient input) { + this.input = input.getOreDict(); + return this; + } + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder output(String output) { + this.output = output; + return this; + } + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder output(OreDictIngredient output) { + this.output = output.getOreDict(); + return this; + } + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder color(int color) { + this.color = color; + return this; + } + + @RecipeBuilderMethodDescription + public MagmaticSmeltery.RecipeBuilder factor(int factor) { + this.factor = factor; + return this; + } + + public String getErrorMsg() { + return "Error adding Magmatic Smeltery Recipe"; + } + + public void validate(GroovyLog.Msg msg) { + msg.add(OreSmeltingRecipe.RECIPE_MAP.containsKey(input), "This OreDict can already be processed in Magmatic Smeltery: {}", input); + msg.add(color < 0 || color >= (1 << 24), "color must be between 0 and 0xffffff, got {}", Integer.toHexString(color)); + } + + @Override + public boolean validate() { + GroovyLog.Msg msg = GroovyLog.msg(getErrorMsg()).error(); + validate(msg); + return !msg.postIfNotEmpty(); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable OreSmeltingRecipe register() { + if (!validate()) return null; + OreSmeltingRecipe recipe = new OreSmeltingRecipe(input, output, color, factor); + recipe.register(); + ModSupport.ESSENTIALCRAFT.get().magmaticSmeltery.addScripted(recipe); + return recipe; + } + } +} 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 77b92a049..4811799f4 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 @@ -1,104 +1,104 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import essentialcraft.api.MithrilineFurnaceRecipe; -import essentialcraft.api.MithrilineFurnaceRecipes; -import net.minecraft.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -import java.util.Arrays; - -@RegistryDescription -public class MithrilineFurnace extends VirtualizedRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:coal_block') * 3).output(item('minecraft:diamond_block')).espe(500)")) - public MithrilineFurnace.RecipeBuilder recipeBuilder() { - return new MithrilineFurnace.RecipeBuilder(); - } - - @Override - public void onReload() { - removeScripted().forEach(MithrilineFurnaceRecipes::removeRecipe); - restoreFromBackup().forEach(MithrilineFurnaceRecipes::addRecipe); - } - - @MethodDescription(example = @Example("ore('dustGlowstone')")) - public boolean removeByInput(IIngredient x) { - return MithrilineFurnaceRecipes.RECIPES.removeIf(r -> { - if (Arrays.stream(x.getMatchingStacks()).anyMatch(r.input)) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('minecraft:emerald')")) - public boolean removeByOutput(IIngredient x) { - return MithrilineFurnaceRecipes.RECIPES.removeIf(r -> { - if (x.test(r.result)) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - MithrilineFurnaceRecipes.RECIPES.forEach(this::addBackup); - MithrilineFurnaceRecipes.RECIPES.clear(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(MithrilineFurnaceRecipes.RECIPES).setRemover(r -> { - addBackup(r); - return MithrilineFurnaceRecipes.RECIPES.remove(r); - }); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int espe; - - @RecipeBuilderMethodDescription - public RecipeBuilder espe(int cost) { - espe = cost; - return this; - } - - @Override - public String getErrorMsg() { - return "Error adding Mithriline Furnace Recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 1); - validateFluids(msg); - msg.add(espe < 1, "espe cost must be 1 or greater, got {}", espe); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable MithrilineFurnaceRecipe register() { - if (!validate()) return null; - int stackSize = input.get(0).getAmount(); - Ingredient inputItem = input.get(0).withAmount(1).toMcIngredient(); - MithrilineFurnaceRecipe recipe = new MithrilineFurnaceRecipe(inputItem, output.get(0), (float) espe, stackSize); - ModSupport.ESSENTIALCRAFT.get().mithrilineFurnace.addScripted(recipe); - MithrilineFurnaceRecipes.addRecipe(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import essentialcraft.api.MithrilineFurnaceRecipe; +import essentialcraft.api.MithrilineFurnaceRecipes; +import net.minecraft.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +@RegistryDescription +public class MithrilineFurnace extends VirtualizedRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:coal_block') * 3).output(item('minecraft:diamond_block')).espe(500)")) + public MithrilineFurnace.RecipeBuilder recipeBuilder() { + return new MithrilineFurnace.RecipeBuilder(); + } + + @Override + public void onReload() { + removeScripted().forEach(MithrilineFurnaceRecipes::removeRecipe); + restoreFromBackup().forEach(MithrilineFurnaceRecipes::addRecipe); + } + + @MethodDescription(example = @Example("ore('dustGlowstone')")) + public boolean removeByInput(IIngredient x) { + return MithrilineFurnaceRecipes.RECIPES.removeIf(r -> { + if (Arrays.stream(x.getMatchingStacks()).anyMatch(r.input)) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('minecraft:emerald')")) + public boolean removeByOutput(IIngredient x) { + return MithrilineFurnaceRecipes.RECIPES.removeIf(r -> { + if (x.test(r.result)) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + MithrilineFurnaceRecipes.RECIPES.forEach(this::addBackup); + MithrilineFurnaceRecipes.RECIPES.clear(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(MithrilineFurnaceRecipes.RECIPES).setRemover(r -> { + addBackup(r); + return MithrilineFurnaceRecipes.RECIPES.remove(r); + }); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int espe; + + @RecipeBuilderMethodDescription + public RecipeBuilder espe(int cost) { + espe = cost; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Mithriline Furnace Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); + msg.add(espe < 1, "espe cost must be 1 or greater, got {}", espe); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable MithrilineFurnaceRecipe register() { + if (!validate()) return null; + int stackSize = input.get(0).getAmount(); + Ingredient inputItem = input.get(0).withAmount(1).toMcIngredient(); + MithrilineFurnaceRecipe recipe = new MithrilineFurnaceRecipe(inputItem, output.get(0), (float) espe, stackSize); + ModSupport.ESSENTIALCRAFT.get().mithrilineFurnace.addScripted(recipe); + MithrilineFurnaceRecipes.addRecipe(recipe); + return recipe; + } + } +} 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 900e703bd..4e2774717 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 @@ -1,113 +1,113 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import essentialcraft.api.RadiatingChamberRecipe; -import essentialcraft.api.RadiatingChamberRecipes; -import net.minecraft.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; - -@RegistryDescription -public class RadiatingChamber extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:nether_star'), item('minecraft:stone')).output(item('minecraft:beacon')).time(100).mruPerTick(10.0f).upperBalance(1.5f).lowerBalance(0.25f)")) - public RadiatingChamber.RecipeBuilder recipeBuilder() { - return new RadiatingChamber.RecipeBuilder(); - } - - @Override - public Collection getRecipes() { - return RadiatingChamberRecipes.RECIPES; - } - - @MethodDescription(example = @Example("item('essentialcraft:genitem', 42)")) - public boolean removeByOutput(IIngredient x) { - return getRecipes().removeIf(r -> { - if (x.test(r.getRecipeOutput())) { - addBackup(r); - return true; - } - return false; - }); - } - - @Property(property = "input", comp = @Comp(gte = 1, lte = 2)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int time; - - @Property(comp = @Comp(gte = 1), defaultValue = "1.0f") - private float mruPerTick = 1.0f; - - @Property(comp = @Comp(gte = 0, lte = 2)) - private float lowerBalance; - - @Property(comp = @Comp(gte = 0, lte = 2), defaultValue = "2.0f") - private float upperBalance = 2.0f; - - @RecipeBuilderMethodDescription - public RadiatingChamber.RecipeBuilder time(int time) { - this.time = time; - return this; - } - - @RecipeBuilderMethodDescription - public RadiatingChamber.RecipeBuilder mruPerTick(float mruPerTick) { - this.mruPerTick = mruPerTick; - return this; - } - - @RecipeBuilderMethodDescription - public RadiatingChamber.RecipeBuilder lowerBalance(float lowerBalance) { - this.lowerBalance = lowerBalance; - return this; - } - - @RecipeBuilderMethodDescription - public RadiatingChamber.RecipeBuilder upperBalance(float upperBalance) { - this.upperBalance = upperBalance; - return this; - } - - @Override - protected int getMaxItemInput() { - return 1; - } - - @Override - public String getErrorMsg() { - return "Error adding Radiating Chamber Recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 2, 1, 1); - validateFluids(msg); - msg.add(time < 1, "time must be 1 or greater, got {}", time); - msg.add(mruPerTick < 1.0f, "mru per tick must be at least 1.0f, got {}", mruPerTick); - msg.add(lowerBalance < 0.0f || lowerBalance > 2.0f, "lower balance must be between 0.0f and 2.0f, got {}", lowerBalance); - msg.add(upperBalance < 0.0f || upperBalance > 2.0f, "upper balance must be between 0.0f and 2.0f, got {}", upperBalance); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable RadiatingChamberRecipe register() { - if (!validate()) return null; - Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); - // the attribute names lie to the devs, they're called 'int mruRequired' and 'float costModifier' - // but actually they're 'int timeInTicks' and 'float mruPerTick' - RadiatingChamberRecipe recipe = new RadiatingChamberRecipe(inputIngredient, output.get(0), time, upperBalance, lowerBalance, mruPerTick); - ModSupport.ESSENTIALCRAFT.get().radiatingChamber.addScripted(recipe); - RadiatingChamberRecipes.addRecipe(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import essentialcraft.api.RadiatingChamberRecipe; +import essentialcraft.api.RadiatingChamberRecipes; +import net.minecraft.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; + +@RegistryDescription +public class RadiatingChamber extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:nether_star'), item('minecraft:stone')).output(item('minecraft:beacon')).time(100).mruPerTick(10.0f).upperBalance(1.5f).lowerBalance(0.25f)")) + public RadiatingChamber.RecipeBuilder recipeBuilder() { + return new RadiatingChamber.RecipeBuilder(); + } + + @Override + public Collection getRecipes() { + return RadiatingChamberRecipes.RECIPES; + } + + @MethodDescription(example = @Example("item('essentialcraft:genitem', 42)")) + public boolean removeByOutput(IIngredient x) { + return getRecipes().removeIf(r -> { + if (x.test(r.getRecipeOutput())) { + addBackup(r); + return true; + } + return false; + }); + } + + @Property(property = "input", comp = @Comp(gte = 1, lte = 2)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int time; + + @Property(comp = @Comp(gte = 1), defaultValue = "1.0f") + private float mruPerTick = 1.0f; + + @Property(comp = @Comp(gte = 0, lte = 2)) + private float lowerBalance; + + @Property(comp = @Comp(gte = 0, lte = 2), defaultValue = "2.0f") + private float upperBalance = 2.0f; + + @RecipeBuilderMethodDescription + public RadiatingChamber.RecipeBuilder time(int time) { + this.time = time; + return this; + } + + @RecipeBuilderMethodDescription + public RadiatingChamber.RecipeBuilder mruPerTick(float mruPerTick) { + this.mruPerTick = mruPerTick; + return this; + } + + @RecipeBuilderMethodDescription + public RadiatingChamber.RecipeBuilder lowerBalance(float lowerBalance) { + this.lowerBalance = lowerBalance; + return this; + } + + @RecipeBuilderMethodDescription + public RadiatingChamber.RecipeBuilder upperBalance(float upperBalance) { + this.upperBalance = upperBalance; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Radiating Chamber Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 2, 1, 1); + validateFluids(msg); + msg.add(time < 1, "time must be 1 or greater, got {}", time); + msg.add(mruPerTick < 1.0f, "mru per tick must be at least 1.0f, got {}", mruPerTick); + msg.add(lowerBalance < 0.0f || lowerBalance > 2.0f, "lower balance must be between 0.0f and 2.0f, got {}", lowerBalance); + msg.add(upperBalance < 0.0f || upperBalance > 2.0f, "upper balance must be between 0.0f and 2.0f, got {}", upperBalance); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable RadiatingChamberRecipe register() { + if (!validate()) return null; + Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); + // the attribute names lie to the devs, they're called 'int mruRequired' and 'float costModifier' + // but actually they're 'int timeInTicks' and 'float mruPerTick' + RadiatingChamberRecipe recipe = new RadiatingChamberRecipe(inputIngredient, output.get(0), time, upperBalance, lowerBalance, mruPerTick); + ModSupport.ESSENTIALCRAFT.get().radiatingChamber.addScripted(recipe); + RadiatingChamberRecipes.addRecipe(recipe); + return recipe; + } + } +} 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 cde4391c0..af19062f0 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 @@ -1,93 +1,93 @@ -package com.cleanroommc.groovyscript.compat.mods.essentialcraft; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import essentialcraft.api.WindImbueRecipe; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; - -@RegistryDescription -public class WindRune extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block')).espe(500)")) - public WindRune.RecipeBuilder recipeBuilder() { - return new WindRune.RecipeBuilder(); - } - - @Override - public Collection getRecipes() { - return WindImbueRecipe.RECIPES; - } - - @MethodDescription(example = @Example("item('minecraft:diamond')")) - public boolean removeByInput(IIngredient x) { - ItemStack[] stacks = x.getMatchingStacks(); - if (stacks.length == 0) return false; - return getRecipes().removeIf(r -> { - if (r.input.test(stacks[0])) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('essentialcraft:air_potion')")) - public boolean removeByOutput(IIngredient x) { - return getRecipes().removeIf(r -> { - if (x.test(r.result)) { - addBackup(r); - return true; - } - return false; - }); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int espe; - - @RecipeBuilderMethodDescription - public RecipeBuilder espe(int cost) { - espe = cost; - return this; - } - - @Override - protected int getMaxItemInput() { - return 1; - } - - @Override - public String getErrorMsg() { - return "Error adding Wind Rune Recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 1); - validateFluids(msg); - msg.add(espe < 1, "espe cost must be 1 or greater, got {}", espe); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable WindImbueRecipe register() { - if (!validate()) return null; - Ingredient inputItem = input.get(0).toMcIngredient(); - WindImbueRecipe recipe = new WindImbueRecipe(inputItem, output.get(0), espe); // also adds the recipe - ModSupport.ESSENTIALCRAFT.get().windRune.addScripted(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.essentialcraft; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import essentialcraft.api.WindImbueRecipe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; + +@RegistryDescription +public class WindRune extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block')).espe(500)")) + public WindRune.RecipeBuilder recipeBuilder() { + return new WindRune.RecipeBuilder(); + } + + @Override + public Collection getRecipes() { + return WindImbueRecipe.RECIPES; + } + + @MethodDescription(example = @Example("item('minecraft:diamond')")) + public boolean removeByInput(IIngredient x) { + ItemStack[] stacks = x.getMatchingStacks(); + if (stacks.length == 0) return false; + return getRecipes().removeIf(r -> { + if (r.input.test(stacks[0])) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('essentialcraft:air_potion')")) + public boolean removeByOutput(IIngredient x) { + return getRecipes().removeIf(r -> { + if (x.test(r.result)) { + addBackup(r); + return true; + } + return false; + }); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int espe; + + @RecipeBuilderMethodDescription + public RecipeBuilder espe(int cost) { + espe = cost; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Wind Rune Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); + msg.add(espe < 1, "espe cost must be 1 or greater, got {}", espe); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable WindImbueRecipe register() { + if (!validate()) return null; + Ingredient inputItem = input.get(0).toMcIngredient(); + WindImbueRecipe recipe = new WindImbueRecipe(inputItem, output.get(0), espe); // also adds the recipe + ModSupport.ESSENTIALCRAFT.get().windRune.addScripted(recipe); + return recipe; + } + } +} 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 1439a79b9..40bdf224c 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 @@ -130,8 +130,9 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable IRecipe register() { if (!validate()) return null; - IRecipe recipe = - org.cyclops.evilcraft.block.BloodInfuser.getInstance().getRecipeRegistry().registerRecipe( + IRecipe recipe = org.cyclops.evilcraft.block.BloodInfuser.getInstance() + .getRecipeRegistry() + .registerRecipe( new IngredientFluidStackAndTierRecipeComponent(input.get(0).toMcIngredient(), fluidInput.get(0), tier), new IngredientRecipeComponent(output.get(0)), new DurationXpRecipeProperties(duration, xp) 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 3c8d58630..adcf4d02d 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 @@ -155,8 +155,9 @@ public void validate(GroovyLog.Msg msg) { @RecipeBuilderRegistrationMethod public @Nullable IRecipe register() { if (!validate()) return null; - IRecipe recipe = - org.cyclops.evilcraft.block.EnvironmentalAccumulator.getInstance().getRecipeRegistry().registerRecipe( + IRecipe recipe = org.cyclops.evilcraft.block.EnvironmentalAccumulator.getInstance() + .getRecipeRegistry() + .registerRecipe( new EnvironmentalAccumulatorRecipeComponent(input.get(0).toMcIngredient(), inputWeather), new EnvironmentalAccumulatorRecipeComponent(output.get(0), outputWeather), new EnvironmentalAccumulatorRecipeProperties(duration, cooldowntime, processingspeed) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/InfoParserWeather.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/InfoParserWeather.java index 611f80c95..a64d8e433 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/InfoParserWeather.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/InfoParserWeather.java @@ -39,5 +39,4 @@ public void parse(InfoParserPackage info) { } instance.add(info.getMessages(), "clear", info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderCrafting.java index 93e6793c1..f82b93ca6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/EnderCrafting.java @@ -76,5 +76,4 @@ public boolean removeByOutput(ItemStack stack) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/ExtendedCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/ExtendedCrafting.java index dad091452..13d144f9e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/ExtendedCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/ExtendedCrafting.java @@ -8,5 +8,4 @@ public class ExtendedCrafting extends GroovyPropertyContainer { public final EnderCrafting enderCrafting = new EnderCrafting(); public final CombinationCrafting combinationCrafting = new CombinationCrafting(); public final CompressionCrafting compressionCrafting = new CompressionCrafting(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableCrafting.java index ebdf85daa..59c843517 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extendedcrafting/TableCrafting.java @@ -75,5 +75,4 @@ public boolean removeByOutput(ItemStack stack) { return false; }); } - } 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 9d5a5a809..ce129c229 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 @@ -70,7 +70,8 @@ public TableRecipeBuilder.Shaped tier(int tier) { @Override @RecipeBuilderRegistrationMethod public ITieredRecipe register() { - GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Extended Crafting Table recipe").error() + GroovyLog.Msg msg = GroovyLog.msg("Error adding shaped Extended Crafting Table recipe") + .error() .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!"); if (msg.postIfNotEmpty()) return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrabotany/ExtraBotany.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrabotany/ExtraBotany.java index baad8bfca..e3a2b8d80 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrabotany/ExtraBotany.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrabotany/ExtraBotany.java @@ -5,5 +5,4 @@ public class ExtraBotany extends GroovyPropertyContainer { public final Pedestal pedestal = new Pedestal(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/ExtraUtils2.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/ExtraUtils2.java index f2a6047a7..45c005871 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/ExtraUtils2.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/ExtraUtils2.java @@ -10,5 +10,4 @@ public class ExtraUtils2 extends GroovyPropertyContainer { public final Furnace furnace = new Furnace(); public final GridPowerPassiveGenerator gridPowerPassiveGenerator = new GridPowerPassiveGenerator(); public final Generator generator = new Generator(); - } 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 043955af1..1e232c5c0 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 @@ -15,10 +15,11 @@ import java.util.List; @RegistryDescription( - admonition = @Admonition(type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true, - value = "groovyscript.wiki.extrautils2.furnace.removeWarning") + admonition = @Admonition( + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true, + value = "groovyscript.wiki.extrautils2.furnace.removeWarning") ) public class Furnace extends VirtualizedRegistry { 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 24979b381..d2fa4c2fb 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 @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; @RegistryDescription public class Generator extends VirtualizedRegistry> { @@ -244,7 +243,6 @@ public static Generators byName(String name) { public String toString() { return location; } - } @Property(property = "input", comp = @Comp(gte = 0, lte = 2)) @@ -329,5 +327,4 @@ public IMachineRecipe register() { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/GridPowerPassiveGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/GridPowerPassiveGenerator.java index be143938d..083a9174f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/GridPowerPassiveGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/extrautils2/GridPowerPassiveGenerator.java @@ -23,6 +23,10 @@ @RegistryDescription public class GridPowerPassiveGenerator extends VirtualizedRegistry> { + private static final Class[] CLOSURE_CLASSES = { + TilePassiveGenerator.class, World.class + }; + public final Map basePowerMap = new Object2FloatOpenHashMap<>(); public final Map> powerLevelMap = new Object2ObjectOpenHashMap<>(); private final Map scalingMap = new Object2ObjectArrayMap<>(); @@ -70,8 +74,9 @@ public void setPowerMultiplier(String generator, IWorldPowerMultiplier worldPowe setPowerMultiplier(new ResourceLocation(generator), worldPowerMultiplier); } - @MethodDescription(type = MethodDescription.Type.VALUE, - example = @Example(value = "resource('generators:solar'), { TilePassiveGenerator generator, World world -> 100f }", imports = "com.rwtema.extrautils2.tile.TilePassiveGenerator")) + @MethodDescription( + type = MethodDescription.Type.VALUE, + example = @Example(value = "resource('generators:solar'), { TilePassiveGenerator generator, World world -> 100f }", imports = "com.rwtema.extrautils2.tile.TilePassiveGenerator")) public void setPowerLevel(ResourceLocation generator, Closure powerLevel) { if (powerLevel == null) { GroovyLog.msg("Extra Utilities 2 Grid Power Passive Generator powerLevel closure must be defined") @@ -79,7 +84,7 @@ public void setPowerLevel(ResourceLocation generator, Closure powerLevel) .post(); return; } - if (!Arrays.equals(powerLevel.getParameterTypes(), new Class[]{TilePassiveGenerator.class, World.class})) { + if (!Arrays.equals(powerLevel.getParameterTypes(), CLOSURE_CLASSES)) { GroovyLog.msg("Extra Utilities 2 Grid Power Passive Generator powerLevel closure should be a closure with exactly two parameters:") .add("com.rwtema.extrautils2.tile.TilePassiveGenerator generator, net.minecraft.world.World world in that order.") .add("but had {}, {} instead", (Object[]) powerLevel.getParameterTypes()) @@ -116,5 +121,4 @@ public void setScaling(ResourceLocation generator, float... scaling) { public void setScaling(String generator, float... scaling) { setScaling(new ResourceLocation(generator), scaling); } - } 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 de3b16080..4bd0da346 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 @@ -117,7 +117,9 @@ public RecipeBuilder shouldProgress(Closure shouldProgress) { .post(); return this; } - if (!Arrays.equals(shouldProgress.getParameterTypes(), new Class[]{TileEntity.class, int.class, ItemStack.class})) { + if (!Arrays.equals(shouldProgress.getParameterTypes(), new Class[]{ + TileEntity.class, int.class, ItemStack.class + })) { GroovyLog.msg("Extra Utilities 2 Resonator shouldProgress closure should be a closure with exactly three parameters:") .add("net.minecraft.tileentity.TileEntity resonator, int frequency, net.minecraft.item.ItemStack input in that order.") .add("but had {}, {}, {} instead", (Object[]) shouldProgress.getParameterTypes()) @@ -129,7 +131,9 @@ public RecipeBuilder shouldProgress(Closure shouldProgress) { } @SuppressWarnings("unchecked") - @RecipeBuilderMethodDescription(field = {"requirementText", "shouldProgress"}) + @RecipeBuilderMethodDescription(field = { + "requirementText", "shouldProgress" + }) public RecipeBuilder rainbow() { this.requirementText = Lang.translate("[Requires an active Rainbow Generator]"); @@ -171,6 +175,7 @@ public void validate(GroovyLog.Msg msg) { public IResonatorRecipe register() { if (!validate()) return null; IResonatorRecipe recipe = new ResonatorRecipe(input.get(0).getMatchingStacks()[0], output.get(0), energy, ownerTag) { + @Override public String getRequirementText() { return requirementText == null ? "" : requirementText; 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 e8739c1c9..bb21c8aca 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 @@ -39,7 +39,10 @@ public boolean isEnabled() { return ForestryAPI.moduleManager.isModuleEnabled("forestry", ForestryModuleUids.APICULTURE); } - public IBeeMutation add(AlleleBeeSpecies output, AlleleBeeSpecies a, AlleleBeeSpecies b, double chance, + public IBeeMutation add(AlleleBeeSpecies output, + AlleleBeeSpecies a, + AlleleBeeSpecies b, + double chance, @Nullable Function requirement) { BeeMutation mutation = new BeeMutation(a, b, Objects.requireNonNull(BeeManager.beeRoot).getTemplate(output), (int) Math.round(100 * chance)); if (requirement != null) mutation = (BeeMutation) requirement.apply(mutation); 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 bd7334c21..0faaac9fd 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 @@ -1,10 +1,8 @@ package com.cleanroommc.groovyscript.compat.mods.forestry; -import com.cleanroommc.groovyscript.GroovyScriptConfig; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.IResourceStack; import com.cleanroommc.groovyscript.core.mixin.forestry.CarpenterRecipeManagerAccessor; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; 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 053679855..9fca57a25 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 @@ -63,8 +63,9 @@ public boolean removeByInput(FluidStack input) { public boolean removeByCatalyst(IIngredient input) { if (FermenterRecipeManagerAccessor.getRecipes().removeIf(recipe -> { - boolean found = input instanceof OreDictIngredient ? recipe.getResourceOreName().equals(((OreDictIngredient) input).getOreDict()) - : recipe.getResource().isItemEqual(input.getMatchingStacks()[0]); + boolean found = input instanceof OreDictIngredient + ? recipe.getResourceOreName().equals(((OreDictIngredient) input).getOreDict()) + : recipe.getResource().isItemEqual(input.getMatchingStacks()[0]); if (found) addBackup(recipe); return found; })) return true; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Forestry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Forestry.java index df1991481..2a9d9596c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Forestry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Forestry.java @@ -30,7 +30,9 @@ public static Result parseSpecies(String mainArg, Object... ar String[] parts = mainArg.split(":"); if (parts.length < 2) { if (args.length > 0 && args[0] instanceof String s) { - parts = new String[]{parts[0], s}; + parts = new String[]{ + parts[0], s + }; } else { Result.error("Can't find bee species for '{}'", mainArg); } 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 296bdd622..4f1adba39 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 @@ -11,8 +11,7 @@ public abstract class ForestryRegistry extends VirtualizedRegistry { - public ForestryRegistry() { - } + public ForestryRegistry() {} public ForestryRegistry(@Nullable Collection aliases) { super(aliases); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/BlastFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/BlastFurnace.java index 71b89a02e..4d9733d81 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/BlastFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/BlastFurnace.java @@ -62,7 +62,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.FUTURE_MC.get().blastFurnace.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Campfire.java index e44c28fdb..fa5f4fe46 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Campfire.java @@ -72,7 +72,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.FUTURE_MC.get().campfire.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/FutureMC.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/FutureMC.java index 7d97d45b9..bb3520e0b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/FutureMC.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/FutureMC.java @@ -9,5 +9,4 @@ public class FutureMC extends GroovyPropertyContainer { public final Smithing smithing = new Smithing(); public final Smoker smoker = new Smoker(); public final Stonecutter stonecutter = new Stonecutter(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smithing.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smithing.java index 36f4c3fab..6a54f7788 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smithing.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smithing.java @@ -64,7 +64,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.FUTURE_MC.get().smithing.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smoker.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smoker.java index bf2b0c7a8..c3c8fedf0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smoker.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smoker.java @@ -62,7 +62,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.FUTURE_MC.get().smoker.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Stonecutter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Stonecutter.java index 7be7fe088..0bd941408 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Stonecutter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Stonecutter.java @@ -62,7 +62,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.FUTURE_MC.get().stonecutter.add(recipe); return recipe; } - } - } 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 f6cb96693..4fd09c7cb 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 @@ -57,7 +57,7 @@ public void removeByOutput(ItemStack... outputs) { .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) { @@ -84,7 +84,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -94,7 +94,7 @@ 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); @@ -106,7 +106,7 @@ 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/MetalFormer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/MetalFormer.java index 4772931b1..52e8af874 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 @@ -62,7 +62,7 @@ public void removeByOutput(int type, ItemStack output) { .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,7 +79,7 @@ public void removeByInput(int type, ItemStack input) { .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(); @@ -96,7 +96,7 @@ public void removeAll(int type) { .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)); @@ -104,7 +104,7 @@ 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 dc1055f55..802f97748 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 @@ -61,7 +61,7 @@ public void removeByOutput(ItemStack... outputs) { .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) { @@ -88,7 +88,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -98,7 +98,7 @@ 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); @@ -106,7 +106,7 @@ 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/exp/BlastFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/BlastFurnace.java index ee63a9064..1cf4710db 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 @@ -72,7 +72,7 @@ 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) { @@ -99,7 +99,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -109,7 +109,7 @@ 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,7 +117,7 @@ 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 7fc48c947..e9669aea4 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 @@ -59,7 +59,7 @@ public void removeByOutput(ItemStack output) { .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(); @@ -76,7 +76,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -86,7 +86,7 @@ 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,7 +94,7 @@ 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 f9e5f93e8..341ee0093 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 @@ -68,7 +68,7 @@ public void removeByOutput(ItemStack output) { .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(); @@ -79,7 +79,7 @@ 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(); @@ -95,7 +95,7 @@ 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); @@ -103,7 +103,7 @@ 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/Extractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Extractor.java index b93a4ac4f..efe1303c9 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 @@ -68,7 +68,7 @@ public void removeByOutput(ItemStack output) { .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,7 +85,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -95,7 +95,7 @@ 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); @@ -103,7 +103,7 @@ 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/FluidCanner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/FluidCanner.java index 2659bc4c0..eb88f1e0a 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 @@ -73,7 +73,7 @@ public void removeByOutput(FluidStack output) { .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(); @@ -90,7 +90,7 @@ public void removeByInput(FluidStack input, ItemStack input1) { .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(); @@ -100,7 +100,7 @@ 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); @@ -108,7 +108,7 @@ 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/Macerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ic2/exp/Macerator.java index 939698794..98f2f26bc 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 @@ -68,7 +68,7 @@ public void removeByOutput(ItemStack output) { .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,7 +85,7 @@ public void removeByInput(ItemStack input) { .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(); @@ -95,7 +95,7 @@ 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); @@ -103,7 +103,7 @@ 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 ee9b6f458..503fab098 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 @@ -21,12 +21,12 @@ public class Recycler extends VirtualizedRegistry { public void onReload() { removeScripted().forEach(recipe -> { if (type == 0) { - for (Iterator iterator = Recipes.recyclerWhitelist.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = Recipes.recyclerWhitelist.iterator(); iterator.hasNext();) { IRecipeInput input = iterator.next(); if (input == recipe) iterator.remove(); } } else { - for (Iterator iterator = Recipes.recyclerBlacklist.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = Recipes.recyclerBlacklist.iterator(); iterator.hasNext();) { IRecipeInput input = iterator.next(); if (input == recipe) iterator.remove(); } 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 1aed4d846..c8055edc1 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 @@ -72,7 +72,7 @@ public void removeByOutput(ItemStack output) { .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(); @@ -89,7 +89,7 @@ public void removeByInput(ItemStack input, ItemStack input1) { .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(); @@ -99,7 +99,7 @@ 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); @@ -107,7 +107,7 @@ 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 0997b0a12..bec372918 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 @@ -107,5 +107,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 92494597a..50e0c3134 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 @@ -71,8 +71,7 @@ public void removeByInput(IIngredient main, List inputAndAdditives) return; } List recipes = getRecipes().stream() - .filter(r -> ImmersiveEngineering.areIngredientsEquals(r.input, main) && - (inputAndAdditives.stream().anyMatch(check -> Arrays.stream(r.additives).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check))))) + .filter(r -> ImmersiveEngineering.areIngredientsEquals(r.input, main) && (inputAndAdditives.stream().anyMatch(check -> Arrays.stream(r.additives).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check))))) .collect(Collectors.toList()); for (ArcFurnaceRecipe recipe : recipes) { remove(recipe); 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 4d874fce1..699be091a 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 @@ -95,5 +95,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 65a168168..9f7872c2f 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 @@ -88,12 +88,16 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { @Property(comp = @Comp(gte = 0)) private int energy; - @RecipeBuilderMethodDescription(field = {"secondaryOutputItems", "secondaryOutputChances"}) + @RecipeBuilderMethodDescription(field = { + "secondaryOutputItems", "secondaryOutputChances" + }) public RecipeBuilder secondaryOutput(ItemStack item) { return this.secondaryOutput(item, 1); } - @RecipeBuilderMethodDescription(field = {"secondaryOutputItems", "secondaryOutputChances"}) + @RecipeBuilderMethodDescription(field = { + "secondaryOutputItems", "secondaryOutputChances" + }) public RecipeBuilder secondaryOutput(ItemStack item, float chance) { this.secondaryOutputItems.add(item); this.secondaryOutputChances.add(chance); 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 f0bd40b89..6b8201aa2 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 @@ -18,9 +18,10 @@ @RegistryDescription( category = RegistryDescription.Category.ENTRIES, - admonition = @Admonition(value = "groovyscript.wiki.immersiveengineering.excavator.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD) + admonition = @Admonition( + value = "groovyscript.wiki.immersiveengineering.excavator.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD) ) public class Excavator extends VirtualizedRegistry> { @@ -64,7 +65,8 @@ public boolean remove(ExcavatorHandler.MineralMix recipe) { @MethodDescription(example = @Example("'silt'")) public boolean removeByMineral(String key) { - List entries = ExcavatorHandler.mineralList.keySet().stream() + List entries = ExcavatorHandler.mineralList.keySet() + .stream() .filter(r -> r.name.equalsIgnoreCase(key)) .collect(Collectors.toList()); for (ExcavatorHandler.MineralMix recipe : entries) { @@ -89,7 +91,8 @@ public void removeByOres(String... ores) { .post(); return; } - List entries = ExcavatorHandler.mineralList.keySet().stream() + List entries = ExcavatorHandler.mineralList.keySet() + .stream() .filter(r -> Arrays.stream(ores).anyMatch(check -> Arrays.stream(r.ores).anyMatch(target -> target.matches(check)))) .collect(Collectors.toList()); for (ExcavatorHandler.MineralMix recipe : entries) { @@ -112,7 +115,8 @@ public void removeByOres(OreDictIngredient... ores) { .post(); return; } - List entries = ExcavatorHandler.mineralList.keySet().stream() + List entries = ExcavatorHandler.mineralList.keySet() + .stream() .filter(r -> Arrays.stream(ores).anyMatch(check -> Arrays.stream(r.ores).anyMatch(target -> target.matches(check.getOreDict())))) .collect(Collectors.toList()); for (ExcavatorHandler.MineralMix recipe : entries) { @@ -174,14 +178,18 @@ public RecipeBuilder fail(float fail) { return this; } - @RecipeBuilderMethodDescription(field = {"ores", "chances"}) + @RecipeBuilderMethodDescription(field = { + "ores", "chances" + }) public RecipeBuilder ore(String ore, float chance) { this.ores.add(ore); this.chances.add(chance); return this; } - @RecipeBuilderMethodDescription(field = {"ores", "chances"}) + @RecipeBuilderMethodDescription(field = { + "ores", "chances" + }) public RecipeBuilder ore(OreDictIngredient ore, float chance) { this.ores.add(ore.getOreDict()); this.chances.add(chance); 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 527d235db..ec0e4808d 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 @@ -55,5 +55,4 @@ public static Object toIEInput(IIngredient ingredient) { ItemStack[] matchingStacks = ingredient.getMatchingStacks(); return matchingStacks.length == 0 ? ItemStack.EMPTY : matchingStacks[0]; } - } 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 f86a683da..95b0cf947 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 @@ -68,8 +68,8 @@ public void removeByInput(IIngredient... itemInputs) { .postIfNotEmpty()) { return; } - List recipes = getRecipes().stream().filter(r -> r.itemInputs.length == itemInputs.length && - Arrays.stream(itemInputs).anyMatch(check -> Arrays.stream(r.itemInputs).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check)))) + List recipes = getRecipes().stream() + .filter(r -> r.itemInputs.length == itemInputs.length && Arrays.stream(itemInputs).anyMatch(check -> Arrays.stream(r.itemInputs).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check)))) .collect(Collectors.toList()); for (MixerRecipe recipe : recipes) { remove(recipe); @@ -91,9 +91,8 @@ public void removeByInput(FluidStack fluidInput, IIngredient... itemInput) { .postIfNotEmpty()) { return; } - List recipes = getRecipes().stream().filter(r -> fluidInput.isFluidEqual(r.fluidInput) && - r.itemInputs.length == itemInput.length && - Arrays.stream(itemInput).anyMatch(check -> Arrays.stream(r.itemInputs).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check)))) + List recipes = getRecipes().stream() + .filter(r -> fluidInput.isFluidEqual(r.fluidInput) && r.itemInputs.length == itemInput.length && Arrays.stream(itemInput).anyMatch(check -> Arrays.stream(r.itemInputs).anyMatch(target -> ImmersiveEngineering.areIngredientsEquals(target, check)))) .collect(Collectors.toList()); for (MixerRecipe recipe : recipes) { remove(recipe); 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 b64e5e764..6236e9cc9 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 @@ -77,7 +77,9 @@ public static class RecipeBuilder extends AbstractRecipeBuilder> { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Boiler.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Boiler.java index 350aba9b0..60f3bda2a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Boiler.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Boiler.java @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/BoilerFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/BoilerFuel.java index e2d05c735..619a3a4c3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/BoilerFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/BoilerFuel.java @@ -88,7 +88,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.IMMERSIVE_TECHNOLOGY.get().boilerFuel.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/CoolingTower.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/CoolingTower.java index 783834469..f8f3ec0af 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/CoolingTower.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/CoolingTower.java @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Distiller.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Distiller.java index 45e518192..dbeff1e6d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Distiller.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Distiller.java @@ -48,7 +48,9 @@ public void removeByInput(IIngredient input) { }); } - @MethodDescription(example = {@Example("fluid('distwater')"), @Example(value = "item('immersivetech:material')", commented = true)}) + @MethodDescription(example = { + @Example("fluid('distwater')"), @Example(value = "item('immersivetech:material')", commented = true) + }) public void removeByOutput(IIngredient output) { getRecipes().removeIf(r -> { for (FluidStack fluidStack : r.getFluidOutputs()) { @@ -120,5 +122,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ElectrolyticCrucibleBattery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ElectrolyticCrucibleBattery.java index 56e5b2110..f2f9a27d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ElectrolyticCrucibleBattery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ElectrolyticCrucibleBattery.java @@ -105,5 +105,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/GasTurbine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/GasTurbine.java index 107c7a3f0..38f7fecf3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/GasTurbine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/GasTurbine.java @@ -47,7 +47,7 @@ public void removeByInput(IIngredient input) { }); } - @MethodDescription(example = @Example(value = "fluid('fluegas')",commented = true)) + @MethodDescription(example = @Example(value = "fluid('fluegas')", commented = true)) public void removeByOutput(IIngredient output) { getRecipes().removeIf(r -> { for (FluidStack fluidStack : r.getFluidOutputs()) { @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HeatExchanger.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HeatExchanger.java index ba67ac52e..0a3f80ce4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HeatExchanger.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HeatExchanger.java @@ -103,5 +103,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HighPressureSteamTurbine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HighPressureSteamTurbine.java index dcafccded..09d92bc60 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HighPressureSteamTurbine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/HighPressureSteamTurbine.java @@ -47,7 +47,7 @@ public void removeByInput(IIngredient input) { }); } - @MethodDescription(example = @Example(value = "fluid('steam')",commented = true)) + @MethodDescription(example = @Example(value = "fluid('steam')", commented = true)) public void removeByOutput(IIngredient output) { getRecipes().removeIf(r -> { for (FluidStack fluidStack : r.getFluidOutputs()) { @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ImmersiveTechnology.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ImmersiveTechnology.java index 2a30c1eca..2b18cb7d2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ImmersiveTechnology.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/ImmersiveTechnology.java @@ -16,5 +16,4 @@ public class ImmersiveTechnology extends GroovyPropertyContainer { public final Radiator radiator = new Radiator(); public final SolarTower solarTower = new SolarTower(); public final SteamTurbine steamTurbine = new SteamTurbine(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/MeltingCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/MeltingCrucible.java index 9c7a22313..75971b29b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/MeltingCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/MeltingCrucible.java @@ -103,5 +103,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Radiator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Radiator.java index 387df3940..73c78229c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Radiator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/Radiator.java @@ -47,7 +47,7 @@ public void removeByInput(IIngredient input) { }); } - @MethodDescription(example = @Example(value = "fluid('distwater')",commented = true)) + @MethodDescription(example = @Example(value = "fluid('distwater')", commented = true)) public void removeByOutput(IIngredient output) { getRecipes().removeIf(r -> { for (FluidStack fluidStack : r.getFluidOutputs()) { @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SolarTower.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SolarTower.java index c2478fb3f..bd1c20cba 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SolarTower.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SolarTower.java @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SteamTurbine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SteamTurbine.java index bef45c13b..c077e1f00 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SteamTurbine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersivetechnology/SteamTurbine.java @@ -94,5 +94,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java index 70423202d..1939b3b07 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java @@ -32,9 +32,10 @@ public IReactorEntry add(ItemStack input) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.bio_reactor.add1", type = MethodDescription.Type.ADDITION) public IReactorEntry add(ItemStack input, @Nullable Predicate nbtCheck) { if (IngredientHelper.overMaxSize(input, 1)) { - GroovyLog.msg("Error adding Bioreactor recipe").error() - .add("Input stack size must be 1") - .post(); + GroovyLog.msg("Error adding Bioreactor recipe") + .error() + .add("Input stack size must be 1") + .post(); return null; } IReactorEntry recipe = new BioReactorEntry(input, nbtCheck); @@ -52,5 +53,4 @@ public boolean removeByInput(IIngredient input) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java index 64ff59c73..6d9120940 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java @@ -34,9 +34,10 @@ public ExtractorEntry add(ItemStack input, FluidStack output) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.extractor.add1", type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:stone'), fluid('water') * 100, 1")) public ExtractorEntry add(ItemStack input, FluidStack output, float breakChance) { if (IngredientHelper.overMaxSize(input, 1)) { - GroovyLog.msg("Error adding Fluid Extractor recipe").error() - .add("Stack size of input must be 1") - .post(); + GroovyLog.msg("Error adding Fluid Extractor recipe") + .error() + .add("Stack size of input must be 1") + .post(); return null; } ExtractorEntry recipe = new ExtractorEntry(input, output, breakChance); @@ -65,5 +66,4 @@ public boolean removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/FluidDictionary.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/FluidDictionary.java index 000624c0d..14031fa5d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/FluidDictionary.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/FluidDictionary.java @@ -71,5 +71,4 @@ public boolean removeByOutput(String fluid) { public boolean removeByOutput(FluidStack fluid) { return removeByOutput(fluid.getFluid().getName()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/IndustrialForegoing.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/IndustrialForegoing.java index bc2322ae7..85ad2c6d9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/IndustrialForegoing.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/IndustrialForegoing.java @@ -14,5 +14,4 @@ public class IndustrialForegoing extends GroovyPropertyContainer { public final ProteinReactor proteinReactor = new ProteinReactor(); public final SludgeRefiner sludgeRefiner = new SludgeRefiner(); public final Straw straw = new Straw(); - } 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 b94a080f6..1031b5123 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 @@ -256,5 +256,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreFermenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreFermenter.java index ed27ad998..648a154b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreFermenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreFermenter.java @@ -51,5 +51,4 @@ public boolean removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java index 3490de3cb..fa45062c1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java @@ -32,9 +32,10 @@ public Collection getRecipes() { }) public OreFluidEntryRaw add(OreDictIngredient ore, FluidStack input, FluidStack output) { if (IngredientHelper.overMaxSize(ore, 1)) { - GroovyLog.msg("Error adding Ore Washer recipe").error() - .add("Stack size of input ore must be 1") - .post(); + GroovyLog.msg("Error adding Ore Washer recipe") + .error() + .add("Stack size of input ore must be 1") + .post(); return null; } return add(ore.getOreDict(), input, output); @@ -84,5 +85,4 @@ public boolean removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java index eb60981d6..73a69e96b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java @@ -32,9 +32,10 @@ public Collection getRecipes() { }) public OreFluidEntrySieve add(FluidStack input, ItemStack output, ItemStack sieveItem) { if (IngredientHelper.overMaxSize(sieveItem, 1)) { - GroovyLog.msg("Error adding Fluid Sieving recipe").error() - .add("Sieve item stack size must be 1") - .post(); + GroovyLog.msg("Error adding Fluid Sieving recipe") + .error() + .add("Sieve item stack size must be 1") + .post(); return null; } OreFluidEntrySieve recipe = new OreFluidEntrySieve(input, output, sieveItem); @@ -66,5 +67,4 @@ public boolean removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java index 65e04109f..00b6d790c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java @@ -32,9 +32,10 @@ public IReactorEntry add(ItemStack input) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.protein_reactor.add1", type = MethodDescription.Type.ADDITION) public IReactorEntry add(ItemStack input, @Nullable Predicate nbtCheck) { if (IngredientHelper.overMaxSize(input, 1)) { - GroovyLog.msg("Error adding Protein Reactor recipe").error() - .add("Input stack size must be 1") - .post(); + GroovyLog.msg("Error adding Protein Reactor recipe") + .error() + .add("Input stack size must be 1") + .post(); return null; } IReactorEntry recipe = new ProteinReactorEntry(input, nbtCheck); @@ -52,5 +53,4 @@ public boolean removeByInput(IIngredient input) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/SludgeRefiner.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/SludgeRefiner.java index b2f0ff358..492b04dc7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/SludgeRefiner.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/SludgeRefiner.java @@ -44,5 +44,4 @@ public boolean removeByOutput(IIngredient output) { return false; }); } - } 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 e348f6055..41e86505e 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 @@ -79,7 +79,9 @@ public boolean remove(Material material) { @MethodDescription public void removeByInput(IBlockState input) { - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() + for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing() + .entrySet() + .stream() .filter(r -> r.getKey().equals(input)) .collect(Collectors.toList())) { addBackup(Pair.of(recipe.getKey(), recipe.getValue())); @@ -89,7 +91,9 @@ 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() + 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())); @@ -99,13 +103,17 @@ public void removeByInput(Block input) { @MethodDescription(example = @Example("blockstate('minecraft:cobblestone')")) public void removeByOutput(IBlockState output) { - for (Map.Entry recipe : InspirationsRegistryAccessor.getAnvilSmashing().entrySet().stream() + 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() + 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())); @@ -180,5 +188,4 @@ public void validate(GroovyLog.Msg msg) { return Pair.of(inputBlock, output); } } - } 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 7acc0c783..2f5aa59c0 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 @@ -32,10 +32,7 @@ public class Cauldron extends StandardListRegistry { private static boolean checkRecipeMatches(ISimpleCauldronRecipe recipe, IIngredient input, ItemStack output, Object inputState, Object outputState) { // Check all relevant parts to determine if we need to match them and if they do match. - return (inputState == null || compareFluids(inputState, recipe.getInputState())) - && (outputState == null || compareFluids(outputState, recipe.getState())) - && (output == null || output.isItemEqual(recipe.getResult())) - && (input == null || recipe.getInput().stream().anyMatch(input)); + return (inputState == null || compareFluids(inputState, recipe.getInputState())) && (outputState == null || compareFluids(outputState, recipe.getState())) && (output == null || output.isItemEqual(recipe.getResult())) && (input == null || recipe.getInput().stream().anyMatch(input)); } private static boolean compareFluids(Object first, Object second) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Inspirations.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Inspirations.java index 41eabc3af..702dec272 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Inspirations.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Inspirations.java @@ -6,5 +6,4 @@ public class Inspirations extends GroovyPropertyContainer { public final Cauldron cauldron = new Cauldron(); public final AnvilSmashing anvilSmashing = new AnvilSmashing(); - } 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 c0e9eeb68..49608b96d 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 @@ -132,19 +132,23 @@ public void validate(GroovyLog.Msg msg) { if (basic) { ModSupport.INTEGRATED_DYNAMICS.get().dryingBasin.addScripted( - BlockDryingBasin.getInstance().getRecipeRegistry().registerRecipe( - new IngredientAndFluidStackRecipeComponent(itemInput, true, fluidInput.getOrEmpty(0)), - new IngredientAndFluidStackRecipeComponent(output.get(0), fluidOutput.getOrEmpty(0)), - new DurationRecipeProperties(duration) - )); + BlockDryingBasin.getInstance() + .getRecipeRegistry() + .registerRecipe( + new IngredientAndFluidStackRecipeComponent(itemInput, true, fluidInput.getOrEmpty(0)), + new IngredientAndFluidStackRecipeComponent(output.get(0), fluidOutput.getOrEmpty(0)), + new DurationRecipeProperties(duration) + )); } if (mechanical) { ModSupport.INTEGRATED_DYNAMICS.get().mechanicalDryingBasin.addScripted( - BlockMechanicalDryingBasin.getInstance().getRecipeRegistry().registerRecipe( - new IngredientAndFluidStackRecipeComponent(itemInput, true, fluidInput.getOrEmpty(0)), - new IngredientAndFluidStackRecipeComponent(output.getOrEmpty(0), fluidOutput.getOrEmpty(0)), - new DurationRecipeProperties(duration) - )); + BlockMechanicalDryingBasin.getInstance() + .getRecipeRegistry() + .registerRecipe( + new IngredientAndFluidStackRecipeComponent(itemInput, true, fluidInput.getOrEmpty(0)), + new IngredientAndFluidStackRecipeComponent(output.getOrEmpty(0), fluidOutput.getOrEmpty(0)), + new DurationRecipeProperties(duration) + )); } return null; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/IntegratedDynamics.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/IntegratedDynamics.java index a8a281db5..fc5554f02 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/IntegratedDynamics.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/IntegratedDynamics.java @@ -8,5 +8,4 @@ public class IntegratedDynamics extends GroovyPropertyContainer { public final MechanicalDryingBasin mechanicalDryingBasin = new MechanicalDryingBasin(); public final Squeezer squeezer = new Squeezer(); public final MechanicalSqueezer mechanicalSqueezer = new MechanicalSqueezer(); - } 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 fad729e97..55b6f1f97 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 @@ -58,8 +58,10 @@ public boolean removeByInput(ItemStack input) { @Property(property = "fluidOutput", comp = @Comp(gte = 0, lte = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder> { - @Property(value = "groovyscript.wiki.integrateddynamics.squeezer.output.value", ignoresInheritedMethods = true, - comp = @Comp(gte = 0, lte = 3)) + @Property( + value = "groovyscript.wiki.integrateddynamics.squeezer.output.value", + ignoresInheritedMethods = true, + comp = @Comp(gte = 0, lte = 3)) private final List output = new ArrayList<>(); @Property(value = "groovyscript.wiki.integrateddynamics.squeezer.duration.value", defaultValue = "10") private int duration = 10; @@ -143,19 +145,23 @@ public void validate(GroovyLog.Msg msg) { if (basic) { ModSupport.INTEGRATED_DYNAMICS.get().squeezer.addScripted( - BlockSqueezer.getInstance().getRecipeRegistry().registerRecipe( - new IngredientRecipeComponent(input.get(0).toMcIngredient()), - new IngredientsAndFluidStackRecipeComponent(output, fluidOutput.getOrEmpty(0)), - new DummyPropertiesComponent() - )); + BlockSqueezer.getInstance() + .getRecipeRegistry() + .registerRecipe( + new IngredientRecipeComponent(input.get(0).toMcIngredient()), + new IngredientsAndFluidStackRecipeComponent(output, fluidOutput.getOrEmpty(0)), + new DummyPropertiesComponent() + )); } if (mechanical) { ModSupport.INTEGRATED_DYNAMICS.get().mechanicalSqueezer.addScripted( - BlockMechanicalSqueezer.getInstance().getRecipeRegistry().registerRecipe( - new IngredientRecipeComponent(input.get(0).toMcIngredient()), - new IngredientsAndFluidStackRecipeComponent(output, fluidOutput.getOrEmpty(0)), - new DurationRecipeProperties(duration) - )); + BlockMechanicalSqueezer.getInstance() + .getRecipeRegistry() + .registerRecipe( + new IngredientRecipeComponent(input.get(0).toMcIngredient()), + new IngredientsAndFluidStackRecipeComponent(output, fluidOutput.getOrEmpty(0)), + new DurationRecipeProperties(duration) + )); } return null; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Catalyst.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Catalyst.java index 4c38fb524..96024df5d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Catalyst.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Catalyst.java @@ -22,10 +22,9 @@ public class Catalyst extends VirtualizedRegistry> { @GroovyBlacklist public void applyChanges(IModRegistry modRegistry) { for (var backupRecipe : getBackupRecipes()) { - ((ModRegistryAccessor) modRegistry).getRecipeCatalysts().get(backupRecipe.getKey()) - .removeIf(x -> backupRecipe.getValue() == null || - x instanceof ItemStack && - ItemStack.areItemStacksEqual((ItemStack) x, backupRecipe.getValue())); + ((ModRegistryAccessor) modRegistry).getRecipeCatalysts() + .get(backupRecipe.getKey()) + .removeIf(x -> backupRecipe.getValue() == null || x instanceof ItemStack && ItemStack.areItemStacksEqual((ItemStack) x, backupRecipe.getValue())); } for (var scriptedRecipe : getScriptedRecipes()) { modRegistry.addRecipeCatalyst(scriptedRecipe.getValue(), scriptedRecipe.getKey()); @@ -72,5 +71,4 @@ public void remove(String category, Collection item) { public void removeByType(String category) { addBackup(Pair.of(category, null)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Category.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Category.java index da0af4020..ffcb813f8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Category.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Category.java @@ -21,8 +21,9 @@ import java.util.Objects; import java.util.function.Function; -@RegistryDescription(category = RegistryDescription.Category.ENTRIES, - admonition = @Admonition("groovyscript.wiki.jei.category.note0")) +@RegistryDescription( + category = RegistryDescription.Category.ENTRIES, + admonition = @Admonition("groovyscript.wiki.jei.category.note0")) public class Category extends VirtualizedRegistry { private boolean hideAllCategories; @@ -117,16 +118,17 @@ public void hideAll() { @SuppressWarnings("ClassCanBeRecord") public static final class CustomCategory { - + private final String id; private final Function> category; private final List catalysts; private final List wrappers; - public CustomCategory(String id, - Function> category, - List catalysts, - List wrappers) { + public CustomCategory( + String id, + Function> category, + List catalysts, + List wrappers) { this.id = id; this.category = category; this.catalysts = catalysts; @@ -154,10 +156,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (CustomCategory) obj; - return Objects.equals(this.id, that.id) && - Objects.equals(this.category, that.category) && - Objects.equals(this.catalysts, that.catalysts) && - Objects.equals(this.wrappers, that.wrappers); + return Objects.equals(this.id, that.id) && Objects.equals(this.category, that.category) && Objects.equals(this.catalysts, that.catalysts) && Objects.equals(this.wrappers, that.wrappers); } @Override @@ -167,11 +166,7 @@ public int hashCode() { @Override public String toString() { - return "CustomCategory[" + - "id=" + id + ", " + - "category=" + category + ", " + - "catalysts=" + catalysts + ", " + - "wrappers=" + wrappers + ']'; + return "CustomCategory[" + "id=" + id + ", " + "category=" + category + ", " + "catalysts=" + catalysts + ", " + "wrappers=" + wrappers + ']'; } } @@ -269,5 +264,4 @@ public boolean validate() { return customCategory; } } - } 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 04b37c619..98765b96c 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 @@ -30,10 +30,11 @@ public class Description extends VirtualizedRegistry, Lis @GroovyBlacklist public void applyAdditions(IModRegistry modRegistry) { for (Pair, List> entry : this.getScriptedRecipes()) { - modRegistry.addIngredientInfo(entry.getLeft().stream().flatMap(x -> Stream.of(x.getMatchingStacks())).collect(Collectors.toList()), - // Currently, it is only possible to add VanillaTypes.ITEM. It may be desirable to add the ability to do other types. - VanillaTypes.ITEM, - entry.getRight().toArray(new String[0])); + modRegistry.addIngredientInfo( + entry.getLeft().stream().flatMap(x -> Stream.of(x.getMatchingStacks())).collect(Collectors.toList()), + // Currently, it is only possible to add VanillaTypes.ITEM. It may be desirable to add the ability to do other types. + VanillaTypes.ITEM, + entry.getRight().toArray(new String[0])); } } @@ -94,5 +95,4 @@ public void remove(List target) { public void remove(IIngredient... target) { addBackup(Pair.of(Arrays.asList(target), null)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/InfoParserTab.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/InfoParserTab.java index 836f6d190..b24a9e567 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/InfoParserTab.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/InfoParserTab.java @@ -48,5 +48,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), list, info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Ingredient.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Ingredient.java index ee4c6766f..526100fbe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Ingredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/Ingredient.java @@ -21,8 +21,9 @@ import java.util.*; -@RegistryDescription(category = RegistryDescription.Category.ENTRIES, - admonition = @Admonition("groovyscript.wiki.jei.ingredient.note0")) +@RegistryDescription( + category = RegistryDescription.Category.ENTRIES, + admonition = @Admonition("groovyscript.wiki.jei.ingredient.note0")) public class Ingredient extends VirtualizedRegistry { private final Map, List> hiddenIngredients = new Object2ObjectOpenHashMap<>(); @@ -55,7 +56,6 @@ public void applyChanges(IIngredientRegistry ingredientRegistry) { //noinspection unchecked,rawtypes ingredientRegistry.addIngredientsAtRuntime(entry.getKey(), ingredientRegistry.getIngredientHelper(entry.getKey()).expandSubtypes((List) entry.getValue())); } - } @Override @@ -253,5 +253,4 @@ public void yeet(IIngredient... ingredients) { public void yeet(Iterable ingredients) { removeAndHide(ingredients); } - } 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 27900602f..48ba5ab51 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 @@ -88,8 +88,9 @@ public static SimpleCommand getJeiCategoriesCommand() { for (IRecipeCategory category : recipeRegistry.getRecipeCategories()) { GroovyLog.get().getWriter().println(" - " + category.getUid()); } - sender.sendMessage(new TextComponentString("JEI Categories has been logged to the ") - .appendSibling(GSCommand.getTextForFile("Groovy Log", GroovyLog.get().getLogFilePath().toString(), new TextComponentString("Click to open GroovyScript log")))); + sender.sendMessage( + new TextComponentString("JEI Categories has been logged to the ") + .appendSibling(GSCommand.getTextForFile("Groovy Log", GroovyLog.get().getLogFilePath().toString(), new TextComponentString("Click to open GroovyScript log")))); }); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java index 66e6172e4..35401ecd3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java @@ -15,5 +15,4 @@ public class JustEnoughItems extends GroovyPropertyContainer { public void initialize(GroovyContainer owner) { InfoParserRegistry.addInfoParser(InfoParserTab.instance); } - } 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 6c8f2b1db..6a19f1ea6 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 @@ -82,5 +82,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 ea3a8db1b..e403c135c 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 @@ -81,5 +81,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 06667b152..a2df1ba14 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 @@ -91,5 +91,4 @@ protected int getMaxItemInput() { return recipe; } } - } 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 29b14d31a..7b3487943 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 @@ -98,5 +98,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/LazyAE2.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/LazyAE2.java index b2a557d29..66581fd99 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/LazyAE2.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/LazyAE2.java @@ -17,5 +17,4 @@ public class LazyAE2 extends GroovyPropertyContainer { public static IDisplayableMatcher matchesIIngredient(IIngredient ingredient) { return IDisplayableMatcher.ofMany(() -> Arrays.asList(ingredient.getMatchingStacks()), ingredient); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/CrushingTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/CrushingTable.java index ea33cb4b7..f64ac6bb6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/CrushingTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/CrushingTable.java @@ -77,7 +77,5 @@ public void validate(GroovyLog.Msg msg) { } return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/GasificationUnit.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/GasificationUnit.java index f55d6dc36..e970dd619 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/GasificationUnit.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/GasificationUnit.java @@ -97,7 +97,5 @@ public void validate(GroovyLog.Msg msg) { } return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Grinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Grinder.java index 6326500d1..6fb34e970 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Grinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Grinder.java @@ -89,7 +89,5 @@ public void validate(GroovyLog.Msg msg) { } return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/HydraulicPress.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/HydraulicPress.java index b7677a29b..1f817be7b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/HydraulicPress.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/HydraulicPress.java @@ -123,7 +123,5 @@ public void validate(GroovyLog.Msg msg) { } return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Magneticraft.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Magneticraft.java index 8b9f6a29b..3e496487f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Magneticraft.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Magneticraft.java @@ -13,5 +13,4 @@ public class Magneticraft extends GroovyPropertyContainer { public final Sieve sieve = new Sieve(); public final SluiceBox sluiceBox = new SluiceBox(); public final Thermopile thermopile = new Thermopile(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/OilHeater.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/OilHeater.java index f17cec0f4..f1d91108a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/OilHeater.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/OilHeater.java @@ -79,7 +79,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.MAGNETICRAFT.get().oilHeater.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Refinery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Refinery.java index 99449abcb..e2edbee37 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Refinery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Refinery.java @@ -71,7 +71,5 @@ public void validate(GroovyLog.Msg msg) { ModSupport.MAGNETICRAFT.get().refinery.add(recipe); return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Sieve.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Sieve.java index 84e399601..f4ba21364 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Sieve.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/Sieve.java @@ -57,7 +57,9 @@ public RecipeBuilder duration(float duration) { return this; } - @RecipeBuilderMethodDescription(field = {"output", "chances"}) + @RecipeBuilderMethodDescription(field = { + "output", "chances" + }) public RecipeBuilder output(ItemStack item, float chance) { this.output.add(item); this.chances.add(chance); @@ -65,7 +67,9 @@ public RecipeBuilder output(ItemStack item, float chance) { } @Override - @RecipeBuilderMethodDescription(field = {"output", "chances"}) + @RecipeBuilderMethodDescription(field = { + "output", "chances" + }) public RecipeBuilder output(ItemStack item) { return output(item, 1.0f); } @@ -106,7 +110,5 @@ public void validate(GroovyLog.Msg msg) { } return recipe; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/SluiceBox.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/SluiceBox.java index 6175c4d6e..29c35d895 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/SluiceBox.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/magneticraft/SluiceBox.java @@ -50,7 +50,9 @@ public static class RecipeBuilder extends AbstractRecipeBuilder> { @@ -225,7 +226,5 @@ public InfusionItems removeAll() { ModSupport.MEKANISM.get().infusion.removeByType(type); return this; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Mekanism.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Mekanism.java index d80202003..22b0b3120 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Mekanism.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/Mekanism.java @@ -90,5 +90,4 @@ public void initialize(GroovyContainer container) { InfoParserRegistry.addInfoParser(InfoParserGas.instance); InfoParserRegistry.addInfoParser(InfoParserInfusion.instance); } - } 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 e49e8a0fe..85fe0ec64 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 @@ -36,7 +36,8 @@ 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() + 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") 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 2608f1842..f15e6293e 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 @@ -99,8 +99,8 @@ public void validate(GroovyLog.Msg msg) { public @Nullable SawmillRecipe register() { if (!validate()) return null; ChanceOutput chanceOutput = IngredientHelper.isEmpty(extra) - ? new ChanceOutput(output.get(0)) - : new ChanceOutput(output.get(0), extra, chance); + ? new ChanceOutput(output.get(0)) + : new ChanceOutput(output.get(0), extra, chance); SawmillRecipe recipe = null; for (ItemStack itemStack : input.get(0).getMatchingStacks()) { SawmillRecipe r = new SawmillRecipe(new ItemStackInput(itemStack), chanceOutput); 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 a1c437cb2..414c7e572 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 @@ -15,10 +15,11 @@ import org.jetbrains.annotations.Nullable; @RegistryDescription( - admonition = @Admonition(value = "groovyscript.wiki.mekanism.smelting.note0", - type = Admonition.Type.DANGER, - format = Admonition.Format.STANDARD, - hasTitle = true)) + admonition = @Admonition( + value = "groovyscript.wiki.mekanism.smelting.note0", + type = Admonition.Type.DANGER, + format = Admonition.Format.STANDARD, + hasTitle = true)) public class Smelting extends VirtualizedMekanismRegistry { public Smelting() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasRecipeBuilder.java index 9ad4f79f8..9101e4949 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mekanism/recipe/GasRecipeBuilder.java @@ -70,5 +70,4 @@ public void validateGases(GroovyLog.Msg msg, int minInput, int maxInput, int min public void validateGases(GroovyLog.Msg msg) { validateGases(msg, 0, 0, 0, 0); } - } 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 8c9779007..2bd7c50b7 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 @@ -8,8 +8,7 @@ public class GasStackList extends ArrayList { - public GasStackList() { - } + public GasStackList() {} public GasStackList(Collection collection) { super(collection); @@ -45,5 +44,4 @@ public void copyElements() { } } } - } 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 55c409e0d..1a7672ae7 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 @@ -18,8 +18,7 @@ public class MekanismIngredientHelper { - private MekanismIngredientHelper() { - } + private MekanismIngredientHelper() {} public static IIngredient optionalIngredient(IIngredient ingredient) { return ingredient != null ? ingredient : IIngredient.ANY; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mysticalagriculture/MysticalAgriculture.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mysticalagriculture/MysticalAgriculture.java index cc7ba1834..e22d7eba6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/mysticalagriculture/MysticalAgriculture.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/mysticalagriculture/MysticalAgriculture.java @@ -5,5 +5,4 @@ public class MysticalAgriculture extends GroovyPropertyContainer { public Reprocessor reprocessor = new Reprocessor(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/NaturesAura.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/NaturesAura.java index dc99007d8..ecd914f9c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/NaturesAura.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/NaturesAura.java @@ -8,5 +8,4 @@ public class NaturesAura extends GroovyPropertyContainer { public final Ritual ritual = new Ritual(); public final Offering offering = new Offering(); public final Spawning spawning = new Spawning(); - } 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 9c963f610..d275a9b86 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 @@ -55,7 +55,7 @@ public boolean removeByName(ResourceLocation name) { return true; } - @MethodDescription( example = @Example("item('naturesaura:infused_stone')")) + @MethodDescription(example = @Example("item('naturesaura:infused_stone')")) public boolean removeByInput(IIngredient input) { return NaturesAuraAPI.TREE_RITUAL_RECIPES.entrySet().removeIf(r -> { for (var ingredient : r.getValue().ingredients) { @@ -83,7 +83,7 @@ public boolean removeBySapling(IIngredient catalyst) { }); } - @MethodDescription( example = @Example("item('naturesaura:eye')")) + @MethodDescription(example = @Example("item('naturesaura:eye')")) public boolean removeByOutput(IIngredient output) { return NaturesAuraAPI.TREE_RITUAL_RECIPES.entrySet().removeIf(r -> { if (output.test(r.getValue().result)) { 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 0a707b4d9..2f6c824c2 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 @@ -193,5 +193,4 @@ private static void register(boolean periodic, AmadronOffer recipe) { return recipe; } } - } 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 fa97d92f9..56b5b5b50 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 @@ -96,5 +96,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 90ecea9f5..5862b6706 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 @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 da5d370ce..158a76ecb 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 @@ -95,5 +95,4 @@ public void validate(GroovyLog.Msg msg) { return Pair.of(fluidInput.get(0), pressure); } } - } 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 6803f4dd6..1de6e0e08 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 @@ -160,5 +160,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PneumaticCraft.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PneumaticCraft.java index baa56195d..f907d27d0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PneumaticCraft.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PneumaticCraft.java @@ -25,5 +25,4 @@ public static ItemIngredient toItemIngredient(IIngredient ingredient) { if (IngredientHelper.isItem(ingredient)) return new ItemIngredient(IngredientHelper.toItemStack(ingredient).copy()); return new ItemIngredient(ItemStack.EMPTY); } - } 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 0a2d8dab0..582e19990 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 @@ -85,5 +85,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 9e7c5cd61..344d3b172 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 @@ -84,5 +84,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 bf064149b..1e232ae98 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 @@ -40,7 +40,9 @@ public boolean removeByOutput(IIngredient output) { }); } - @MethodDescription(example = {@Example("item('minecraft:coal')"), @Example("fluid('diesel')")}) + @MethodDescription(example = { + @Example("item('minecraft:coal')"), @Example("fluid('diesel')") + }) public boolean removeByInput(IIngredient input) { return getRecipes().removeIf(entry -> { if (entry instanceof BasicThermopneumaticProcessingPlantRecipe recipe && (input.test(recipe.getInputLiquid()) || input.test(recipe.getInputItem()))) { @@ -102,5 +104,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 68ddbc41e..70a5311b1 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 @@ -105,5 +105,4 @@ public void validate(GroovyLog.Msg msg) { return Pair.of(fluidInput.get(0), ratio); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/PrimalTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/PrimalTech.java index ea905b395..0b112bad5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/PrimalTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/PrimalTech.java @@ -8,5 +8,4 @@ public class PrimalTech extends GroovyPropertyContainer { public final StoneAnvil stoneAnvil = new StoneAnvil(); public final WaterSaw waterSaw = new WaterSaw(); public final WoodenBasin woodenBasin = new WoodenBasin(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WoodenBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WoodenBasin.java index 47589e783..c9424c76d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WoodenBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/primaltech/WoodenBasin.java @@ -47,15 +47,16 @@ public WoodenBasinRecipes add(ItemStack output, FluidStack fluid, IIngredient... .register(); } - @MethodDescription(example = {@Example("fluid('lava')"), @Example(value = "item('minecraft:cobblestone')", commented = true)}) + @MethodDescription(example = { + @Example("fluid('lava')"), @Example(value = "item('minecraft:cobblestone')", commented = true) + }) public boolean removeByInput(IIngredient input) { return getRecipes().removeIf(recipe -> { - if (input.test(recipe.getFluidStack()) || - Arrays.stream(recipe.getInputs()).anyMatch(x -> { - if (x instanceof ItemStack is) return input.test(is); - if (x instanceof List list) return list.stream().map(i -> (ItemStack) i).anyMatch(input); - return false; - })) { + if (input.test(recipe.getFluidStack()) || Arrays.stream(recipe.getInputs()).anyMatch(x -> { + if (x instanceof ItemStack is) return input.test(is); + if (x instanceof Listlist) return list.stream().map(i -> (ItemStack) i).anyMatch(input); + return false; + })) { addBackup(recipe); return true; } @@ -96,7 +97,9 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; WoodenBasinRecipes recipe = null; List> cartesian = Lists.cartesianProduct( - input.stream().map(x -> x instanceof OreDictIngredient ore + input.stream() + .map( + x -> x instanceof OreDictIngredient ore ? Collections.singletonList(ore.getOreDict()) : Arrays.asList(x.toMcIngredient().getMatchingStacks())) .collect(Collectors.toList())); 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 ef659be33..2b77a03a6 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 @@ -1,200 +1,200 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import lykrast.prodigytech.common.recipe.AtomicReshaperManager; -import lykrast.prodigytech.common.util.Config; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@RegistryDescription -public class AtomicReshaper extends VirtualizedRegistry { - - @RecipeBuilderDescription(example = { - @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:emerald_block')).primordium(10).time(50)"), - @Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block'), 10).output(item('minecraft:carrot'), 3).primordium(7)") - }) - public AtomicReshaper.RecipeBuilder recipeBuilder() { - return new AtomicReshaper.RecipeBuilder(); - } - - @Override - public void onReload() { - removeScripted().forEach(recipe -> { - if (recipe.isOreRecipe()) { - AtomicReshaperManager.INSTANCE.removeOreRecipe(recipe.getOreInput()); - } else { - AtomicReshaperManager.INSTANCE.removeRecipe(recipe.getInput()); - } - }); - restoreFromBackup().forEach(AtomicReshaperManager.INSTANCE::addRecipe); - } - - @MethodDescription(example = @Example("ore('paper')")) - public boolean removeByInput(IIngredient input) { - if (input instanceof OreDictIngredient) { - AtomicReshaperManager.AtomicReshaperRecipe recipe = AtomicReshaperManager.INSTANCE.removeOreRecipe(((OreDictIngredient) input).getOreDict()); - if (recipe == null) return false; - addBackup(recipe); - return true; - } else { - boolean success = false; - for (ItemStack it : input.getMatchingStacks()) { - AtomicReshaperManager.AtomicReshaperRecipe recipe = AtomicReshaperManager.INSTANCE.removeRecipe(it); - if (recipe != null) { - success = true; - addBackup(recipe); - } - } - return success; - } - } - - private boolean backupAndRemove(AtomicReshaperManager.AtomicReshaperRecipe recipe) { - AtomicReshaperManager.AtomicReshaperRecipe removed; - if (recipe.isOreRecipe()) { - removed = AtomicReshaperManager.INSTANCE.removeOreRecipe(recipe.getOreInput()); - } else { - removed = AtomicReshaperManager.INSTANCE.removeRecipe(recipe.getInput()); - } - if (removed == null) { - return false; - } - addBackup(removed); - return true; - } - - public void add(AtomicReshaperManager.AtomicReshaperRecipe recipe) { - AtomicReshaperManager.INSTANCE.addRecipe(recipe); - addScripted(recipe); - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - AtomicReshaperManager.INSTANCE.getAllRecipes().forEach(this::addBackup); - AtomicReshaperManager.INSTANCE.removeAll(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(AtomicReshaperManager.INSTANCE.getAllRecipes()) - .setRemover(this::backupAndRemove); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(gte = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1), defaultValue = "Config.atomicReshaperProcessTime") - private int time = Config.atomicReshaperProcessTime; - - @Property(comp = @Comp(gte = 1)) - private int primordium; - - private final List outputWeights = new ArrayList<>(); - - @RecipeBuilderMethodDescription - public AtomicReshaper.RecipeBuilder time(int time) { - this.time = time; - return this; - } - - @RecipeBuilderMethodDescription - public AtomicReshaper.RecipeBuilder primordium(int primordium) { - this.primordium = primordium; - return this; - } - - public AtomicReshaper.RecipeBuilder output(ItemStack output) { - output(output, 1); - return this; - } - - public AtomicReshaper.RecipeBuilder output(ItemStack... outputs) { - for (ItemStack output : outputs) { - output(output, 1); - } - return this; - } - - public AtomicReshaper.RecipeBuilder output(Collection outputs) { - for (ItemStack output : outputs) { - output(output, 1); - } - return this; - } - - @RecipeBuilderMethodDescription - public AtomicReshaper.RecipeBuilder output(ItemStack output, int weight) { - this.output.add(output); - outputWeights.add(weight); - return this; - } - - @Override - public String getErrorMsg() { - return "Error adding ProdigyTech Atomic Reshaper Recipe"; - } - - @Override - protected int getMaxItemInput() { - // The recipe correctly requires an increased amount of input items, but only consumes 1 - return 1; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, Integer.MAX_VALUE); - validateFluids(msg); - - // I think this check is not possible to fail at all but still, adding it for consistency - msg.add(output.size() != outputWeights.size(), "Outputs and output weights must be the same size!"); - - msg.add(outputWeights.stream().anyMatch(x -> x <= 0), "all weighted outputs must be greater than 0, yet they were {}", outputWeights); - msg.add(primordium <= 0, "primordium must be greater than or equal to 1, yet it was {}", primordium); - // 100 is hardcoded in the source - int capacity = Config.atomicReshaperMaxPrimordium * 100; - msg.add(primordium > capacity, "primordium must be less than or equal to the Reshaper's capacity {}, yet it was {}", capacity, primordium); - msg.add(time <= 0, "time must be greater than 0, got {}", time); - } - - private Object[] getRecipeOutput() { - List target = new ArrayList<>(); - for (int i = 0; i < output.size(); i++) { - target.add(output.get(i)); - target.add(outputWeights.get(i)); - } - return target.toArray(); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable AtomicReshaperManager.AtomicReshaperRecipe register() { - if (!validate()) return null; - AtomicReshaperManager.AtomicReshaperRecipe recipe = null; - IIngredient inputItem = input.get(0); - if (inputItem instanceof OreDictIngredient) { - String oredict = ((OreDictIngredient) inputItem).getOreDict(); - recipe = new AtomicReshaperManager.AtomicReshaperRecipe(oredict, time, primordium, getRecipeOutput()); - ModSupport.PRODIGY_TECH.get().atomicReshaper.add(recipe); - } else { - for (ItemStack it : inputItem.getMatchingStacks()) { - recipe = new AtomicReshaperManager.AtomicReshaperRecipe(it, time, primordium, getRecipeOutput()); - ModSupport.PRODIGY_TECH.get().atomicReshaper.add(recipe); - } - } - - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import lykrast.prodigytech.common.recipe.AtomicReshaperManager; +import lykrast.prodigytech.common.util.Config; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +@RegistryDescription +public class AtomicReshaper extends VirtualizedRegistry { + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:emerald_block')).primordium(10).time(50)"), + @Example(".input(item('minecraft:gold_block')).output(item('minecraft:diamond_block'), 10).output(item('minecraft:carrot'), 3).primordium(7)") + }) + public AtomicReshaper.RecipeBuilder recipeBuilder() { + return new AtomicReshaper.RecipeBuilder(); + } + + @Override + public void onReload() { + removeScripted().forEach(recipe -> { + if (recipe.isOreRecipe()) { + AtomicReshaperManager.INSTANCE.removeOreRecipe(recipe.getOreInput()); + } else { + AtomicReshaperManager.INSTANCE.removeRecipe(recipe.getInput()); + } + }); + restoreFromBackup().forEach(AtomicReshaperManager.INSTANCE::addRecipe); + } + + @MethodDescription(example = @Example("ore('paper')")) + public boolean removeByInput(IIngredient input) { + if (input instanceof OreDictIngredient) { + AtomicReshaperManager.AtomicReshaperRecipe recipe = AtomicReshaperManager.INSTANCE.removeOreRecipe(((OreDictIngredient) input).getOreDict()); + if (recipe == null) return false; + addBackup(recipe); + return true; + } else { + boolean success = false; + for (ItemStack it : input.getMatchingStacks()) { + AtomicReshaperManager.AtomicReshaperRecipe recipe = AtomicReshaperManager.INSTANCE.removeRecipe(it); + if (recipe != null) { + success = true; + addBackup(recipe); + } + } + return success; + } + } + + private boolean backupAndRemove(AtomicReshaperManager.AtomicReshaperRecipe recipe) { + AtomicReshaperManager.AtomicReshaperRecipe removed; + if (recipe.isOreRecipe()) { + removed = AtomicReshaperManager.INSTANCE.removeOreRecipe(recipe.getOreInput()); + } else { + removed = AtomicReshaperManager.INSTANCE.removeRecipe(recipe.getInput()); + } + if (removed == null) { + return false; + } + addBackup(removed); + return true; + } + + public void add(AtomicReshaperManager.AtomicReshaperRecipe recipe) { + AtomicReshaperManager.INSTANCE.addRecipe(recipe); + addScripted(recipe); + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + AtomicReshaperManager.INSTANCE.getAllRecipes().forEach(this::addBackup); + AtomicReshaperManager.INSTANCE.removeAll(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(AtomicReshaperManager.INSTANCE.getAllRecipes()) + .setRemover(this::backupAndRemove); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(gte = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1), defaultValue = "Config.atomicReshaperProcessTime") + private int time = Config.atomicReshaperProcessTime; + + @Property(comp = @Comp(gte = 1)) + private int primordium; + + private final List outputWeights = new ArrayList<>(); + + @RecipeBuilderMethodDescription + public AtomicReshaper.RecipeBuilder time(int time) { + this.time = time; + return this; + } + + @RecipeBuilderMethodDescription + public AtomicReshaper.RecipeBuilder primordium(int primordium) { + this.primordium = primordium; + return this; + } + + public AtomicReshaper.RecipeBuilder output(ItemStack output) { + output(output, 1); + return this; + } + + public AtomicReshaper.RecipeBuilder output(ItemStack... outputs) { + for (ItemStack output : outputs) { + output(output, 1); + } + return this; + } + + public AtomicReshaper.RecipeBuilder output(Collection outputs) { + for (ItemStack output : outputs) { + output(output, 1); + } + return this; + } + + @RecipeBuilderMethodDescription + public AtomicReshaper.RecipeBuilder output(ItemStack output, int weight) { + this.output.add(output); + outputWeights.add(weight); + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding ProdigyTech Atomic Reshaper Recipe"; + } + + @Override + protected int getMaxItemInput() { + // The recipe correctly requires an increased amount of input items, but only consumes 1 + return 1; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, Integer.MAX_VALUE); + validateFluids(msg); + + // I think this check is not possible to fail at all but still, adding it for consistency + msg.add(output.size() != outputWeights.size(), "Outputs and output weights must be the same size!"); + + msg.add(outputWeights.stream().anyMatch(x -> x <= 0), "all weighted outputs must be greater than 0, yet they were {}", outputWeights); + msg.add(primordium <= 0, "primordium must be greater than or equal to 1, yet it was {}", primordium); + // 100 is hardcoded in the source + int capacity = Config.atomicReshaperMaxPrimordium * 100; + msg.add(primordium > capacity, "primordium must be less than or equal to the Reshaper's capacity {}, yet it was {}", capacity, primordium); + msg.add(time <= 0, "time must be greater than 0, got {}", time); + } + + private Object[] getRecipeOutput() { + List target = new ArrayList<>(); + for (int i = 0; i < output.size(); i++) { + target.add(output.get(i)); + target.add(outputWeights.get(i)); + } + return target.toArray(); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable AtomicReshaperManager.AtomicReshaperRecipe register() { + if (!validate()) return null; + AtomicReshaperManager.AtomicReshaperRecipe recipe = null; + IIngredient inputItem = input.get(0); + if (inputItem instanceof OreDictIngredient) { + String oredict = ((OreDictIngredient) inputItem).getOreDict(); + recipe = new AtomicReshaperManager.AtomicReshaperRecipe(oredict, time, primordium, getRecipeOutput()); + ModSupport.PRODIGY_TECH.get().atomicReshaper.add(recipe); + } else { + for (ItemStack it : inputItem.getMatchingStacks()) { + recipe = new AtomicReshaperManager.AtomicReshaperRecipe(it, time, primordium, getRecipeOutput()); + ModSupport.PRODIGY_TECH.get().atomicReshaper.add(recipe); + } + } + + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java index 3535dcc46..5d5fe3958 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java @@ -1,231 +1,226 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.Example; -import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; -import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import lykrast.prodigytech.common.recipe.ExplosionFurnaceManager; -import net.minecraft.item.ItemStack; - -import java.util.Objects; - -@RegistryDescription(category = RegistryDescription.Category.ENTRIES) -public class ExplosionFurnaceAdditives extends VirtualizedRegistry { - - @Override - public void onReload() { - removeScripted().forEach(EFAdditiveRecipe::unregister); - restoreFromBackup().forEach(EFAdditiveRecipe::register); - } - - private void add(EFAdditiveRecipe recipe) { - recipe.register(); - addScripted(recipe); - } - - private void remove(EFAdditiveRecipe recipe) { - recipe.unregister(); - addBackup(recipe); - } - - @MethodDescription(example = @Example("item('minecraft:cobblestone'), 50"), type = MethodDescription.Type.ADDITION) - public void addExplosive(IIngredient explosive, int power) { - if (IngredientHelper.overMaxSize(explosive, 1)) { - GroovyLog.msg("Error adding Explosion Furnace Explosive").error() - .add("Expected input stack size of 1") - .post(); - return; - } - - EFAdditiveRecipe recipe = new EFAdditiveExplosive(explosive, power); - add(recipe); - } - - @MethodDescription(example = @Example("ore('gunpowder')")) - public boolean removeExplosive(IIngredient explosive) { - for (ItemStack it : explosive.getMatchingStacks()) { - ExplosionFurnaceManager.Explosive externalExplosive = ExplosionFurnaceManager.findExplosive(it); - if (externalExplosive == null) continue; - EFAdditiveRecipe recipe = new EFAdditiveExplosive(explosive, externalExplosive.getPower()); - remove(recipe); - return true; - } - return false; - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAllExplosives() { - ExplosionFurnaceManager.EXPLOSIVES.getAllContent().forEach(r -> addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower()))); - ExplosionFurnaceManager.removeAllExplosives(); - } - - @MethodDescription(example = @Example("item('minecraft:stone'), 50"), type = MethodDescription.Type.ADDITION) - public void addDampener(IIngredient dampener, int power) { - if (IngredientHelper.overMaxSize(dampener, 1)) { - GroovyLog.msg("Error adding Explosion Furnace Dampener").error() - .add("Expected input stack size of 1") - .post(); - return; - } - - EFAdditiveRecipe recipe = new EFAdditiveDampener(dampener, power); - add(recipe); - } - - @MethodDescription(example = @Example("ore('dustAsh')")) - public boolean removeDampener(IIngredient dampener) { - for (ItemStack it : dampener.getMatchingStacks()) { - ExplosionFurnaceManager.Dampener externalDampener = ExplosionFurnaceManager.findDampener(it); - if (externalDampener == null) continue; - EFAdditiveRecipe recipe = new EFAdditiveDampener(dampener, externalDampener.getDampening()); - remove(recipe); - return true; - } - return false; - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAllDampeners() { - ExplosionFurnaceManager.DAMPENERS.getAllContent().forEach(r -> - addBackup(new EFAdditiveDampener(new ItemsIngredient(r.getMatchingStacks()), r.getDampening()))); - ExplosionFurnaceManager.removeAllDampeners(); - } - - public interface EFAdditiveRecipe { - - void register(); - - void unregister(); - } - - @SuppressWarnings("ClassCanBeRecord") - public static final class EFAdditiveExplosive implements EFAdditiveRecipe { - - private final IIngredient input; - private final int value; - - public EFAdditiveExplosive(IIngredient input, int value) { - this.input = input; - this.value = value; - } - - @Override - public void register() { - if (this.input instanceof OreDictIngredient) { - ExplosionFurnaceManager.addExplosive(((OreDictIngredient) this.input).getOreDict(), this.value); - } else { - for (ItemStack it : this.input.getMatchingStacks()) { - ExplosionFurnaceManager.addExplosive(it, this.value); - } - } - } - - @Override - public void unregister() { - if (this.input instanceof OreDictIngredient) { - ExplosionFurnaceManager.removeExplosive(((OreDictIngredient) this.input).getOreDict()); - } else { - for (ItemStack it : this.input.getMatchingStacks()) { - ExplosionFurnaceManager.removeExplosive(it); - } - } - } - - public IIngredient input() { - return input; - } - - public int value() { - return value; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (EFAdditiveExplosive) obj; - return Objects.equals(this.input, that.input) && - this.value == that.value; - } - - @Override - public int hashCode() { - return Objects.hash(input, value); - } - - @Override - public String toString() { - return "EFAdditiveExplosive[" + - "input=" + input + ", " + - "value=" + value + ']'; - } - } - - @SuppressWarnings("ClassCanBeRecord") - public static final class EFAdditiveDampener implements EFAdditiveRecipe { - - private final IIngredient input; - private final int value; - - public EFAdditiveDampener(IIngredient input, int value) { - this.input = input; - this.value = value; - } - - @Override - public void register() { - if (this.input instanceof OreDictIngredient) { - ExplosionFurnaceManager.addDampener(((OreDictIngredient) this.input).getOreDict(), this.value); - } else { - for (ItemStack it : this.input.getMatchingStacks()) { - ExplosionFurnaceManager.addDampener(it, this.value); - } - } - } - - @Override - public void unregister() { - if (this.input instanceof OreDictIngredient) { - ExplosionFurnaceManager.removeDampener(((OreDictIngredient) this.input).getOreDict()); - } else { - for (ItemStack it : this.input.getMatchingStacks()) { - ExplosionFurnaceManager.removeDampener(it); - } - } - } - - public IIngredient input() { - return input; - } - - public int value() { - return value; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (EFAdditiveDampener) obj; - return Objects.equals(this.input, that.input) && - this.value == that.value; - } - - @Override - public int hashCode() { - return Objects.hash(input, value); - } - - @Override - public String toString() { - return "EFAdditiveDampener[" + - "input=" + input + ", " + - "value=" + value + ']'; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import lykrast.prodigytech.common.recipe.ExplosionFurnaceManager; +import net.minecraft.item.ItemStack; + +import java.util.Objects; + +@RegistryDescription(category = RegistryDescription.Category.ENTRIES) +public class ExplosionFurnaceAdditives extends VirtualizedRegistry { + + @Override + public void onReload() { + removeScripted().forEach(EFAdditiveRecipe::unregister); + restoreFromBackup().forEach(EFAdditiveRecipe::register); + } + + private void add(EFAdditiveRecipe recipe) { + recipe.register(); + addScripted(recipe); + } + + private void remove(EFAdditiveRecipe recipe) { + recipe.unregister(); + addBackup(recipe); + } + + @MethodDescription(example = @Example("item('minecraft:cobblestone'), 50"), type = MethodDescription.Type.ADDITION) + public void addExplosive(IIngredient explosive, int power) { + if (IngredientHelper.overMaxSize(explosive, 1)) { + GroovyLog.msg("Error adding Explosion Furnace Explosive") + .error() + .add("Expected input stack size of 1") + .post(); + return; + } + + EFAdditiveRecipe recipe = new EFAdditiveExplosive(explosive, power); + add(recipe); + } + + @MethodDescription(example = @Example("ore('gunpowder')")) + public boolean removeExplosive(IIngredient explosive) { + for (ItemStack it : explosive.getMatchingStacks()) { + ExplosionFurnaceManager.Explosive externalExplosive = ExplosionFurnaceManager.findExplosive(it); + if (externalExplosive == null) continue; + EFAdditiveRecipe recipe = new EFAdditiveExplosive(explosive, externalExplosive.getPower()); + remove(recipe); + return true; + } + return false; + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAllExplosives() { + ExplosionFurnaceManager.EXPLOSIVES.getAllContent().forEach(r -> addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower()))); + ExplosionFurnaceManager.removeAllExplosives(); + } + + @MethodDescription(example = @Example("item('minecraft:stone'), 50"), type = MethodDescription.Type.ADDITION) + public void addDampener(IIngredient dampener, int power) { + if (IngredientHelper.overMaxSize(dampener, 1)) { + GroovyLog.msg("Error adding Explosion Furnace Dampener") + .error() + .add("Expected input stack size of 1") + .post(); + return; + } + + EFAdditiveRecipe recipe = new EFAdditiveDampener(dampener, power); + add(recipe); + } + + @MethodDescription(example = @Example("ore('dustAsh')")) + public boolean removeDampener(IIngredient dampener) { + for (ItemStack it : dampener.getMatchingStacks()) { + ExplosionFurnaceManager.Dampener externalDampener = ExplosionFurnaceManager.findDampener(it); + if (externalDampener == null) continue; + EFAdditiveRecipe recipe = new EFAdditiveDampener(dampener, externalDampener.getDampening()); + remove(recipe); + return true; + } + return false; + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAllDampeners() { + ExplosionFurnaceManager.DAMPENERS.getAllContent().forEach(r -> addBackup(new EFAdditiveDampener(new ItemsIngredient(r.getMatchingStacks()), r.getDampening()))); + ExplosionFurnaceManager.removeAllDampeners(); + } + + public interface EFAdditiveRecipe { + + void register(); + + void unregister(); + } + + @SuppressWarnings("ClassCanBeRecord") + public static final class EFAdditiveExplosive implements EFAdditiveRecipe { + + private final IIngredient input; + private final int value; + + public EFAdditiveExplosive(IIngredient input, int value) { + this.input = input; + this.value = value; + } + + @Override + public void register() { + if (this.input instanceof OreDictIngredient) { + ExplosionFurnaceManager.addExplosive(((OreDictIngredient) this.input).getOreDict(), this.value); + } else { + for (ItemStack it : this.input.getMatchingStacks()) { + ExplosionFurnaceManager.addExplosive(it, this.value); + } + } + } + + @Override + public void unregister() { + if (this.input instanceof OreDictIngredient) { + ExplosionFurnaceManager.removeExplosive(((OreDictIngredient) this.input).getOreDict()); + } else { + for (ItemStack it : this.input.getMatchingStacks()) { + ExplosionFurnaceManager.removeExplosive(it); + } + } + } + + public IIngredient input() { + return input; + } + + public int value() { + return value; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (EFAdditiveExplosive) obj; + return Objects.equals(this.input, that.input) && this.value == that.value; + } + + @Override + public int hashCode() { + return Objects.hash(input, value); + } + + @Override + public String toString() { + return "EFAdditiveExplosive[" + "input=" + input + ", " + "value=" + value + ']'; + } + } + + @SuppressWarnings("ClassCanBeRecord") + public static final class EFAdditiveDampener implements EFAdditiveRecipe { + + private final IIngredient input; + private final int value; + + public EFAdditiveDampener(IIngredient input, int value) { + this.input = input; + this.value = value; + } + + @Override + public void register() { + if (this.input instanceof OreDictIngredient) { + ExplosionFurnaceManager.addDampener(((OreDictIngredient) this.input).getOreDict(), this.value); + } else { + for (ItemStack it : this.input.getMatchingStacks()) { + ExplosionFurnaceManager.addDampener(it, this.value); + } + } + } + + @Override + public void unregister() { + if (this.input instanceof OreDictIngredient) { + ExplosionFurnaceManager.removeDampener(((OreDictIngredient) this.input).getOreDict()); + } else { + for (ItemStack it : this.input.getMatchingStacks()) { + ExplosionFurnaceManager.removeDampener(it); + } + } + } + + public IIngredient input() { + return input; + } + + public int value() { + return value; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (EFAdditiveDampener) obj; + return Objects.equals(this.input, that.input) && this.value == that.value; + } + + @Override + public int hashCode() { + return Objects.hash(input, value); + } + + @Override + public String toString() { + return "EFAdditiveDampener[" + "input=" + input + ", " + "value=" + value + ']'; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java index acc1c81a2..1405fa6ed 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java @@ -1,87 +1,90 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.Example; -import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; -import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import lykrast.prodigytech.common.recipe.PrimordialisReactorManager; -import net.minecraft.item.ItemStack; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@RegistryDescription(category = RegistryDescription.Category.ENTRIES) -public class PrimordialisReactor extends VirtualizedRegistry { - - @Override - public void onReload() { - removeScripted().forEach(this::removeRecipeBase); - restoreFromBackup().forEach(this::addRecipeBase); - } - - private void addRecipeBase(IIngredient x) { - if (x instanceof OreDictIngredient) { - PrimordialisReactorManager.addInput(((OreDictIngredient) x).getOreDict()); - } else { - for (ItemStack it : x.getMatchingStacks()) { - PrimordialisReactorManager.addInput(it); - } - } - } - - private boolean removeRecipeBase(IIngredient x) { - if (x instanceof OreDictIngredient) { - PrimordialisReactorManager.removeInput(((OreDictIngredient) x).getOreDict()); - } else { - for (ItemStack it : x.getMatchingStacks()) { - PrimordialisReactorManager.removeInput(it); - } - } - // the mod's API does not expose a boolean there - return true; - } - - @MethodDescription(example = @Example("item('minecraft:diamond')"), type = MethodDescription.Type.ADDITION) - public void add(IIngredient x) { - if (IngredientHelper.overMaxSize(x, 1)) { - // PT modifies the recipe to only consume 1 item - GroovyLog.msg("Error adding Primordialis Reactor fuel").error() - .add("Expected input stack size of 1") - .post(); - return; - } - - addScripted(x); - addRecipeBase(x); - } - - @MethodDescription(example = @Example("ore('sugarcane')")) - public boolean remove(IIngredient x) { - addBackup(x); - return removeRecipeBase(x); - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - PrimordialisReactorManager.getAllEntries().forEach(r -> addBackup(new ItemsIngredient(r))); - PrimordialisReactorManager.getAllOreEntries().forEach(r -> addBackup(new OreDictIngredient(r))); - PrimordialisReactorManager.removeAll(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - Stream normalRecipes = PrimordialisReactorManager.getAllEntries().stream() - .map(ItemsIngredient::new); - Stream oreDictRecipes = PrimordialisReactorManager.getAllOreEntries().stream() - .map(OreDictIngredient::new); - List items = Stream.concat(normalRecipes, oreDictRecipes).collect(Collectors.toList()); - return new SimpleObjectStream<>(items).setRemover(this::remove); - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import lykrast.prodigytech.common.recipe.PrimordialisReactorManager; +import net.minecraft.item.ItemStack; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@RegistryDescription(category = RegistryDescription.Category.ENTRIES) +public class PrimordialisReactor extends VirtualizedRegistry { + + @Override + public void onReload() { + removeScripted().forEach(this::removeRecipeBase); + restoreFromBackup().forEach(this::addRecipeBase); + } + + private void addRecipeBase(IIngredient x) { + if (x instanceof OreDictIngredient) { + PrimordialisReactorManager.addInput(((OreDictIngredient) x).getOreDict()); + } else { + for (ItemStack it : x.getMatchingStacks()) { + PrimordialisReactorManager.addInput(it); + } + } + } + + private boolean removeRecipeBase(IIngredient x) { + if (x instanceof OreDictIngredient) { + PrimordialisReactorManager.removeInput(((OreDictIngredient) x).getOreDict()); + } else { + for (ItemStack it : x.getMatchingStacks()) { + PrimordialisReactorManager.removeInput(it); + } + } + // the mod's API does not expose a boolean there + return true; + } + + @MethodDescription(example = @Example("item('minecraft:diamond')"), type = MethodDescription.Type.ADDITION) + public void add(IIngredient x) { + if (IngredientHelper.overMaxSize(x, 1)) { + // PT modifies the recipe to only consume 1 item + GroovyLog.msg("Error adding Primordialis Reactor fuel") + .error() + .add("Expected input stack size of 1") + .post(); + return; + } + + addScripted(x); + addRecipeBase(x); + } + + @MethodDescription(example = @Example("ore('sugarcane')")) + public boolean remove(IIngredient x) { + addBackup(x); + return removeRecipeBase(x); + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + PrimordialisReactorManager.getAllEntries().forEach(r -> addBackup(new ItemsIngredient(r))); + PrimordialisReactorManager.getAllOreEntries().forEach(r -> addBackup(new OreDictIngredient(r))); + PrimordialisReactorManager.removeAll(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + Stream normalRecipes = PrimordialisReactorManager.getAllEntries() + .stream() + .map(ItemsIngredient::new); + Stream oreDictRecipes = PrimordialisReactorManager.getAllOreEntries() + .stream() + .map(OreDictIngredient::new); + List items = Stream.concat(normalRecipes, oreDictRecipes).collect(Collectors.toList()); + return new SimpleObjectStream<>(items).setRemover(this::remove); + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ProdigyTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ProdigyTech.java index 893819a76..e9aa197c0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ProdigyTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ProdigyTech.java @@ -1,18 +1,17 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; - -public class ProdigyTech extends GroovyPropertyContainer { - - public final AtomicReshaper atomicReshaper = new AtomicReshaper(); - public final ExplosionFurnace explosionFurnace = new ExplosionFurnace(); - public final ExplosionFurnaceAdditives explosionAdditives = new ExplosionFurnaceAdditives(); - public final SimpleRecipeHandler magneticReassembler = new SimpleRecipeHandler.MagneticReassembler(); - public final SimpleRecipeHandlerSecondaryOutput oreRefinery = new SimpleRecipeHandlerSecondaryOutput.OreRefinery(); - public final SimpleRecipeHandler grinder = new SimpleRecipeHandler.RotaryGrinder(); - public final PrimordialisReactor primordialisReactor = new PrimordialisReactor(); - public final SimpleRecipeHandlerSecondaryOutput sawmill = new SimpleRecipeHandlerSecondaryOutput.HeatSawmill(); - public final Solderer solderer = new Solderer(); - public final ZorraAltar zorraAltar = new ZorraAltar(); - -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; + +public class ProdigyTech extends GroovyPropertyContainer { + + public final AtomicReshaper atomicReshaper = new AtomicReshaper(); + public final ExplosionFurnace explosionFurnace = new ExplosionFurnace(); + public final ExplosionFurnaceAdditives explosionAdditives = new ExplosionFurnaceAdditives(); + public final SimpleRecipeHandler magneticReassembler = new SimpleRecipeHandler.MagneticReassembler(); + public final SimpleRecipeHandlerSecondaryOutput oreRefinery = new SimpleRecipeHandlerSecondaryOutput.OreRefinery(); + public final SimpleRecipeHandler grinder = new SimpleRecipeHandler.RotaryGrinder(); + public final PrimordialisReactor primordialisReactor = new PrimordialisReactor(); + public final SimpleRecipeHandlerSecondaryOutput sawmill = new SimpleRecipeHandlerSecondaryOutput.HeatSawmill(); + public final Solderer solderer = new Solderer(); + public final ZorraAltar zorraAltar = new ZorraAltar(); +} 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 9cae6add8..2377f442e 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 @@ -1,117 +1,117 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import lykrast.prodigytech.common.recipe.MagneticReassemblerManager; -import lykrast.prodigytech.common.recipe.RotaryGrinderManager; -import lykrast.prodigytech.common.recipe.SimpleRecipe; -import lykrast.prodigytech.common.recipe.SimpleRecipeManager; -import lykrast.prodigytech.common.util.Config; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -public abstract class SimpleRecipeHandler extends SimpleRecipeHandlerAbstract { - - @RecipeBuilderDescription(example = { - @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"), - @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))") - }) - public SimpleRecipeHandler.RecipeBuilder recipeBuilder() { - return new SimpleRecipeHandler.RecipeBuilder(); - } - - SimpleRecipeHandler(String name, SimpleRecipeManager instance) { - super(name, instance); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1), defaultValue = "(default time for this machine in the mod's config)") - private int time = getDefaultTime(); - - @RecipeBuilderMethodDescription - public RecipeBuilder time(int time) { - this.time = time; - return this; - } - - @Override - protected int getMaxItemInput() { - // PT modifies the recipe to only consume 1 item - return 1; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 1); - validateFluids(msg); - msg.add(time <= 0, "time must be greater than 0, got {}", time); - } - - @Override - public String getErrorMsg() { - return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandler.this.name); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable SimpleRecipe register() { - if (!validate()) return null; - SimpleRecipe recipe = null; - IIngredient input1 = input.get(0); - if (input1 instanceof OreDictIngredient) { - recipe = new SimpleRecipe(((OreDictIngredient) input1).getOreDict(), output.get(0), time); - addRecipe(recipe); - } else { - for (ItemStack input : input1.getMatchingStacks()) { - recipe = new SimpleRecipe(input, output.get(0), time); - addRecipe(recipe); - } - } - return recipe; - } - } - - @RegistryDescription - public static class RotaryGrinder extends SimpleRecipeHandler { - - RotaryGrinder() { - super("Rotary Grinder", RotaryGrinderManager.INSTANCE); - } - - @Override - protected int getDefaultTime() { - return Config.rotaryGrinderProcessTime; - } - - @Override - @MethodDescription(example = @Example("item('minecraft:gravel')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - } - - @RegistryDescription - public static class MagneticReassembler extends SimpleRecipeHandler { - - MagneticReassembler() { - super("Magnetic Reassembler", MagneticReassemblerManager.INSTANCE); - } - - @Override - protected int getDefaultTime() { - return Config.magneticReassemblerProcessTime; - } - - @Override - @MethodDescription(example = @Example("item('minecraft:gravel')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import lykrast.prodigytech.common.recipe.MagneticReassemblerManager; +import lykrast.prodigytech.common.recipe.RotaryGrinderManager; +import lykrast.prodigytech.common.recipe.SimpleRecipe; +import lykrast.prodigytech.common.recipe.SimpleRecipeManager; +import lykrast.prodigytech.common.util.Config; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +public abstract class SimpleRecipeHandler extends SimpleRecipeHandlerAbstract { + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"), + @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))") + }) + public SimpleRecipeHandler.RecipeBuilder recipeBuilder() { + return new SimpleRecipeHandler.RecipeBuilder(); + } + + SimpleRecipeHandler(String name, SimpleRecipeManager instance) { + super(name, instance); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1), defaultValue = "(default time for this machine in the mod's config)") + private int time = getDefaultTime(); + + @RecipeBuilderMethodDescription + public RecipeBuilder time(int time) { + this.time = time; + return this; + } + + @Override + protected int getMaxItemInput() { + // PT modifies the recipe to only consume 1 item + return 1; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); + msg.add(time <= 0, "time must be greater than 0, got {}", time); + } + + @Override + public String getErrorMsg() { + return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandler.this.name); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable SimpleRecipe register() { + if (!validate()) return null; + SimpleRecipe recipe = null; + IIngredient input1 = input.get(0); + if (input1 instanceof OreDictIngredient) { + recipe = new SimpleRecipe(((OreDictIngredient) input1).getOreDict(), output.get(0), time); + addRecipe(recipe); + } else { + for (ItemStack input : input1.getMatchingStacks()) { + recipe = new SimpleRecipe(input, output.get(0), time); + addRecipe(recipe); + } + } + return recipe; + } + } + + @RegistryDescription + public static class RotaryGrinder extends SimpleRecipeHandler { + + RotaryGrinder() { + super("Rotary Grinder", RotaryGrinderManager.INSTANCE); + } + + @Override + protected int getDefaultTime() { + return Config.rotaryGrinderProcessTime; + } + + @Override + @MethodDescription(example = @Example("item('minecraft:gravel')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + } + + @RegistryDescription + public static class MagneticReassembler extends SimpleRecipeHandler { + + MagneticReassembler() { + super("Magnetic Reassembler", MagneticReassemblerManager.INSTANCE); + } + + @Override + protected int getDefaultTime() { + return Config.magneticReassemblerProcessTime; + } + + @Override + @MethodDescription(example = @Example("item('minecraft:gravel')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + } +} 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 9931036b6..05b81d28e 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 @@ -1,127 +1,127 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import lykrast.prodigytech.common.recipe.*; -import lykrast.prodigytech.common.util.Config; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -public abstract class SimpleRecipeHandlerSecondaryOutput extends SimpleRecipeHandlerAbstract { - - @RecipeBuilderDescription(example = { - @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"), - @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))"), - @Example(".input(item('minecraft:iron_block')).output(item('minecraft:emerald'), item('minecraft:clay'))"), - @Example(".input(item('minecraft:gold_block')).output(item('minecraft:emerald'), item('minecraft:nether_star')).secondaryChance(0.25).time(50)") - }) - public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder recipeBuilder() { - return new SimpleRecipeHandlerSecondaryOutput.RecipeBuilder(); - } - - SimpleRecipeHandlerSecondaryOutput(String name, SimpleRecipeManagerSecondaryOutput instance) { - super(name, instance); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(gte = 1, lte = 2)) - public class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int time = getDefaultTime(); - - @Property(comp = @Comp(lte = 1), defaultValue = "1.0f") - private float secondaryChance = 1.0f; - - @RecipeBuilderMethodDescription - public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder time(int time) { - this.time = time; - return this; - } - - @RecipeBuilderMethodDescription - public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder secondaryChance(float secondaryOutput) { - this.secondaryChance = secondaryOutput; - return this; - } - - @Override - protected int getMaxItemInput() { - // PT modifies the recipe to only consume 1 item - return 1; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 2); - validateFluids(msg); - msg.add(time <= 0, "time must be greater than 0, got {}", time); - msg.add(secondaryChance > 1.0f || secondaryChance < 0.0f, "secondary output has to be between 0 and 1, got {}", secondaryChance); - } - - @Override - public String getErrorMsg() { - return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandlerSecondaryOutput.this.name); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable SimpleRecipeSecondaryOutput register() { - if (!validate()) return null; - SimpleRecipeSecondaryOutput recipe = null; - IIngredient input1 = input.get(0); - ItemStack secondaryOutput = output.size() == 1 ? ItemStack.EMPTY : output.get(1); - if (input1 instanceof OreDictIngredient) { - recipe = new SimpleRecipeSecondaryOutput(((OreDictIngredient) input1).getOreDict(), output.get(0), secondaryOutput, time, secondaryChance); - addRecipe(recipe); - } else { - for (ItemStack input : input1.getMatchingStacks()) { - recipe = new SimpleRecipeSecondaryOutput(input, output.get(0), secondaryOutput, time, secondaryChance); - addRecipe(recipe); - } - } - return recipe; - } - } - - @RegistryDescription - public static class HeatSawmill extends SimpleRecipeHandlerSecondaryOutput { - - HeatSawmill() { - super("Heat Sawmill", HeatSawmillManager.INSTANCE); - } - - @Override - protected int getDefaultTime() { - return Config.heatSawmillProcessTime; - } - - @Override - @MethodDescription(example = @Example("ore('plankWood')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - } - - @RegistryDescription - public static class OreRefinery extends SimpleRecipeHandlerSecondaryOutput { - - OreRefinery() { - super("Ore Refinery", OreRefineryManager.INSTANCE); - } - - @Override - protected int getDefaultTime() { - return Config.oreRefineryProcessTime; - } - - @Override - @MethodDescription(example = @Example("ore('oreLapis')")) - public boolean removeByInput(IIngredient input) { - return super.removeByInput(input); - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import lykrast.prodigytech.common.recipe.*; +import lykrast.prodigytech.common.util.Config; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +public abstract class SimpleRecipeHandlerSecondaryOutput extends SimpleRecipeHandlerAbstract { + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).time(50)"), + @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:coal'))"), + @Example(".input(item('minecraft:iron_block')).output(item('minecraft:emerald'), item('minecraft:clay'))"), + @Example(".input(item('minecraft:gold_block')).output(item('minecraft:emerald'), item('minecraft:nether_star')).secondaryChance(0.25).time(50)") + }) + public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder recipeBuilder() { + return new SimpleRecipeHandlerSecondaryOutput.RecipeBuilder(); + } + + SimpleRecipeHandlerSecondaryOutput(String name, SimpleRecipeManagerSecondaryOutput instance) { + super(name, instance); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(gte = 1, lte = 2)) + public class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int time = getDefaultTime(); + + @Property(comp = @Comp(lte = 1), defaultValue = "1.0f") + private float secondaryChance = 1.0f; + + @RecipeBuilderMethodDescription + public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder time(int time) { + this.time = time; + return this; + } + + @RecipeBuilderMethodDescription + public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder secondaryChance(float secondaryOutput) { + this.secondaryChance = secondaryOutput; + return this; + } + + @Override + protected int getMaxItemInput() { + // PT modifies the recipe to only consume 1 item + return 1; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 2); + validateFluids(msg); + msg.add(time <= 0, "time must be greater than 0, got {}", time); + msg.add(secondaryChance > 1.0f || secondaryChance < 0.0f, "secondary output has to be between 0 and 1, got {}", secondaryChance); + } + + @Override + public String getErrorMsg() { + return String.format("Error adding ProdigyTech %s Recipe", SimpleRecipeHandlerSecondaryOutput.this.name); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable SimpleRecipeSecondaryOutput register() { + if (!validate()) return null; + SimpleRecipeSecondaryOutput recipe = null; + IIngredient input1 = input.get(0); + ItemStack secondaryOutput = output.size() == 1 ? ItemStack.EMPTY : output.get(1); + if (input1 instanceof OreDictIngredient) { + recipe = new SimpleRecipeSecondaryOutput(((OreDictIngredient) input1).getOreDict(), output.get(0), secondaryOutput, time, secondaryChance); + addRecipe(recipe); + } else { + for (ItemStack input : input1.getMatchingStacks()) { + recipe = new SimpleRecipeSecondaryOutput(input, output.get(0), secondaryOutput, time, secondaryChance); + addRecipe(recipe); + } + } + return recipe; + } + } + + @RegistryDescription + public static class HeatSawmill extends SimpleRecipeHandlerSecondaryOutput { + + HeatSawmill() { + super("Heat Sawmill", HeatSawmillManager.INSTANCE); + } + + @Override + protected int getDefaultTime() { + return Config.heatSawmillProcessTime; + } + + @Override + @MethodDescription(example = @Example("ore('plankWood')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(input); + } + } + + @RegistryDescription + public static class OreRefinery extends SimpleRecipeHandlerSecondaryOutput { + + OreRefinery() { + super("Ore Refinery", OreRefineryManager.INSTANCE); + } + + @Override + protected int getDefaultTime() { + return Config.oreRefineryProcessTime; + } + + @Override + @MethodDescription(example = @Example("ore('oreLapis')")) + public boolean removeByInput(IIngredient input) { + return super.removeByInput(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 8cca3a0db..ba346500a 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 @@ -1,168 +1,168 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import lykrast.prodigytech.common.recipe.SoldererManager; -import lykrast.prodigytech.common.util.Config; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -@RegistryDescription -public class Solderer extends VirtualizedRegistry { - - @RecipeBuilderDescription(example = { - @Example(".pattern(item('minecraft:clay')).input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).gold(5).time(100)"), - @Example(".pattern(item('minecraft:coal_block')).output(item('minecraft:nether_star')).gold(75)"), - }) - public Solderer.RecipeBuilder recipeBuilder() { - return new Solderer.RecipeBuilder(); - } - - @Override - public void onReload() { - removeScripted().forEach(x -> SoldererManager.removeRecipe(x.getPattern(), x.getAdditive(), 9999)); - restoreFromBackup().forEach(SoldererManager::addRecipe); - } - - public void add(SoldererManager.SoldererRecipe recipe) { - if (recipe == null) return; - addScripted(recipe); - SoldererManager.addRecipe(recipe); - } - - public boolean remove(SoldererManager.SoldererRecipe recipe) { - if (recipe == null) return false; - addBackup(recipe); - return SoldererManager.removeRecipe(recipe.getPattern(), recipe.getAdditive(), 9999) != null; - } - - @MethodDescription(example = @Example("item('prodigytech:pattern_circuit_refined')")) - public boolean removeByPattern(IIngredient pattern) { - return SoldererManager.RECIPES.removeIf(r -> { - if (pattern.test(r.getPattern())) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('minecraft:iron_ingot')")) - public boolean removeByAdditive(IIngredient additive) { - return SoldererManager.RECIPES.removeIf(r -> { - if (r.requiresAdditive() && additive.test(r.getPattern())) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('prodigytech:circuit_refined')")) - public boolean removeByOutput(IIngredient output) { - return SoldererManager.RECIPES.removeIf(r -> { - if (output.test(r.getPattern())) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - SoldererManager.RECIPES.forEach(this::addBackup); - SoldererManager.removeAll(); - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeWithoutAdditive() { - SoldererManager.RECIPES.removeIf(r -> { - if (r.requiresAdditive()) return false; - addBackup(r); - return true; - }); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(SoldererManager.RECIPES) - .setRemover(this::remove); - } - - @Property(property = "input", comp = @Comp(gte = 0, lte = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Property(comp = @Comp(gte = 1)) - private int time = Config.soldererProcessTime; - - @Property(comp = @Comp(gte = 1)) - private int gold; - - @Property(comp = @Comp(eq = 1)) - private IIngredient pattern; - - @RecipeBuilderMethodDescription - public Solderer.RecipeBuilder time(int time) { - this.time = time; - return this; - } - - @RecipeBuilderMethodDescription - public Solderer.RecipeBuilder gold(int gold) { - this.gold = gold; - return this; - } - - @RecipeBuilderMethodDescription - public Solderer.RecipeBuilder pattern(IIngredient pattern) { - this.pattern = pattern; - return this; - } - - @Override - public String getErrorMsg() { - return "Error adding ProdigyTech Solderer Recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 0, 1, 1, 1); - validateFluids(msg); - msg.add(gold <= 0, "gold must be greater than or equal to 1, yet it was {}", gold); - msg.add(IngredientHelper.isEmpty(pattern), "pattern cannot be empty"); - int capacity = Config.soldererMaxGold; - msg.add(gold > capacity, "gold must be less than or equal to the Solderer's capacity {}, yet it was {}", capacity, gold); - msg.add(time <= 0, "time must be greater than 0, got {}", time); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable SoldererManager.SoldererRecipe register() { - if (!validate()) return null; - SoldererManager.SoldererRecipe recipe = null; - for (ItemStack pat : pattern.getMatchingStacks()) { - if (input.isEmpty()) { - SoldererManager.SoldererRecipe theRecipe = new SoldererManager.SoldererRecipe(pat, ItemStack.EMPTY, output.get(0), gold, time); - ModSupport.PRODIGY_TECH.get().solderer.add(theRecipe); - if (recipe == null) recipe = theRecipe; - } else { - for (ItemStack additive : input.get(0).getMatchingStacks()) { - SoldererManager.SoldererRecipe theRecipe = new SoldererManager.SoldererRecipe(pat, additive, output.get(0), gold, time); - ModSupport.PRODIGY_TECH.get().solderer.add(theRecipe); - if (recipe == null) recipe = theRecipe; - } - } - } - - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import lykrast.prodigytech.common.recipe.SoldererManager; +import lykrast.prodigytech.common.util.Config; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +@RegistryDescription +public class Solderer extends VirtualizedRegistry { + + @RecipeBuilderDescription(example = { + @Example(".pattern(item('minecraft:clay')).input(item('minecraft:gold_ingot')).output(item('minecraft:diamond')).gold(5).time(100)"), + @Example(".pattern(item('minecraft:coal_block')).output(item('minecraft:nether_star')).gold(75)"), + }) + public Solderer.RecipeBuilder recipeBuilder() { + return new Solderer.RecipeBuilder(); + } + + @Override + public void onReload() { + removeScripted().forEach(x -> SoldererManager.removeRecipe(x.getPattern(), x.getAdditive(), 9999)); + restoreFromBackup().forEach(SoldererManager::addRecipe); + } + + public void add(SoldererManager.SoldererRecipe recipe) { + if (recipe == null) return; + addScripted(recipe); + SoldererManager.addRecipe(recipe); + } + + public boolean remove(SoldererManager.SoldererRecipe recipe) { + if (recipe == null) return false; + addBackup(recipe); + return SoldererManager.removeRecipe(recipe.getPattern(), recipe.getAdditive(), 9999) != null; + } + + @MethodDescription(example = @Example("item('prodigytech:pattern_circuit_refined')")) + public boolean removeByPattern(IIngredient pattern) { + return SoldererManager.RECIPES.removeIf(r -> { + if (pattern.test(r.getPattern())) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('minecraft:iron_ingot')")) + public boolean removeByAdditive(IIngredient additive) { + return SoldererManager.RECIPES.removeIf(r -> { + if (r.requiresAdditive() && additive.test(r.getPattern())) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('prodigytech:circuit_refined')")) + public boolean removeByOutput(IIngredient output) { + return SoldererManager.RECIPES.removeIf(r -> { + if (output.test(r.getPattern())) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + SoldererManager.RECIPES.forEach(this::addBackup); + SoldererManager.removeAll(); + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeWithoutAdditive() { + SoldererManager.RECIPES.removeIf(r -> { + if (r.requiresAdditive()) return false; + addBackup(r); + return true; + }); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(SoldererManager.RECIPES) + .setRemover(this::remove); + } + + @Property(property = "input", comp = @Comp(gte = 0, lte = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int time = Config.soldererProcessTime; + + @Property(comp = @Comp(gte = 1)) + private int gold; + + @Property(comp = @Comp(eq = 1)) + private IIngredient pattern; + + @RecipeBuilderMethodDescription + public Solderer.RecipeBuilder time(int time) { + this.time = time; + return this; + } + + @RecipeBuilderMethodDescription + public Solderer.RecipeBuilder gold(int gold) { + this.gold = gold; + return this; + } + + @RecipeBuilderMethodDescription + public Solderer.RecipeBuilder pattern(IIngredient pattern) { + this.pattern = pattern; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding ProdigyTech Solderer Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 0, 1, 1, 1); + validateFluids(msg); + msg.add(gold <= 0, "gold must be greater than or equal to 1, yet it was {}", gold); + msg.add(IngredientHelper.isEmpty(pattern), "pattern cannot be empty"); + int capacity = Config.soldererMaxGold; + msg.add(gold > capacity, "gold must be less than or equal to the Solderer's capacity {}, yet it was {}", capacity, gold); + msg.add(time <= 0, "time must be greater than 0, got {}", time); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable SoldererManager.SoldererRecipe register() { + if (!validate()) return null; + SoldererManager.SoldererRecipe recipe = null; + for (ItemStack pat : pattern.getMatchingStacks()) { + if (input.isEmpty()) { + SoldererManager.SoldererRecipe theRecipe = new SoldererManager.SoldererRecipe(pat, ItemStack.EMPTY, output.get(0), gold, time); + ModSupport.PRODIGY_TECH.get().solderer.add(theRecipe); + if (recipe == null) recipe = theRecipe; + } else { + for (ItemStack additive : input.get(0).getMatchingStacks()) { + SoldererManager.SoldererRecipe theRecipe = new SoldererManager.SoldererRecipe(pat, additive, output.get(0), gold, time); + ModSupport.PRODIGY_TECH.get().solderer.add(theRecipe); + if (recipe == null) recipe = theRecipe; + } + } + } + + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java index c28f19087..d383329db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ZorraAltar.java @@ -1,120 +1,117 @@ -package com.cleanroommc.groovyscript.compat.mods.prodigytech; - -import com.cleanroommc.groovyscript.api.GroovyBlacklist; -import com.cleanroommc.groovyscript.api.documentation.annotations.Example; -import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; -import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lykrast.prodigytech.common.recipe.ZorraAltarManager; -import lykrast.prodigytech.common.util.Config; -import net.minecraft.enchantment.Enchantment; - -import java.util.Map; -import java.util.Objects; - - -@RegistryDescription -public class ZorraAltar extends VirtualizedRegistry { - - @GroovyBlacklist - private static final Map managers = new Object2ObjectOpenHashMap<>(); - - ZorraAltar() { - managers.put("sword", ZorraAltarManager.SWORD); - managers.put("bow", ZorraAltarManager.BOW); - } - - public ZorraAltarManager createRegistry(String key) { - ZorraAltarManager manager = new ZorraAltarManager(); - managers.put(key, manager); - return manager; - } - - public ZorraAltarManager getRegistry(String key) { - return managers.get(key); - } - - @GroovyBlacklist - public void onReload() { - removeScripted().forEach(this::removeEnchantment); - restoreFromBackup().forEach(this::addEnchantment); - } - - private void addEnchantment(ZorraRecipeData recipe) { - if (!managers.containsKey(recipe.registry)) return; - managers.get(recipe.registry).addEnchant(recipe.enchantment, recipe.maxLevel); - } - - private void removeEnchantment(ZorraRecipeData recipe) { - if (!managers.containsKey(recipe.registry)) return; - managers.get(recipe.registry).removeEnchant(recipe.enchantment); - } - - @MethodDescription(example = { - @Example("'sword', enchantment('minecraft:power'), 10"), - @Example("'stick', enchantment('minecraft:knockback'), 20") - }) - public void addEnchantment(String registry, Enchantment enchantment, int maxLevel) { - if (!managers.containsKey(registry)) return; - managers.get(registry).addEnchant(enchantment, maxLevel); - addScripted(new ZorraRecipeData(registry, enchantment, maxLevel)); - } - - @MethodDescription(example = @Example("'sword', enchantment('minecraft:sharpness')")) - public boolean removeEnchantment(String registry, Enchantment enchantment) { - if (!managers.containsKey(registry)) return false; - int maxLevel = enchantment.getMaxLevel(); - if (maxLevel > 1) - maxLevel += Config.altarBonusLvl; - addBackup(new ZorraRecipeData(registry, enchantment, maxLevel)); - return managers.get(registry).removeEnchant(enchantment); - } - - @SuppressWarnings("ClassCanBeRecord") - public static final class ZorraRecipeData { - - private final String registry; - private final Enchantment enchantment; - private final int maxLevel; - - public ZorraRecipeData(String registry, Enchantment enchantment, int maxLevel) { - this.registry = registry; - this.enchantment = enchantment; - this.maxLevel = maxLevel; - } - - public String registry() {return registry;} - - public Enchantment enchantment() { - return enchantment; - } - - public int maxLevel() { - return maxLevel; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (ZorraRecipeData) obj; - return Objects.equals(this.registry, that.registry) && - Objects.equals(this.enchantment, that.enchantment) && - this.maxLevel == that.maxLevel; - } - - @Override - public int hashCode() { - return Objects.hash(registry, enchantment, maxLevel); - } - - @Override - public String toString() { - return "ZorraRecipeData[" + - "registry=" + registry + ", " + - "enchantment=" + enchantment + ", " + - "maxLevel=" + maxLevel + ']'; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.prodigytech; + +import com.cleanroommc.groovyscript.api.GroovyBlacklist; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lykrast.prodigytech.common.recipe.ZorraAltarManager; +import lykrast.prodigytech.common.util.Config; +import net.minecraft.enchantment.Enchantment; + +import java.util.Map; +import java.util.Objects; + + +@RegistryDescription +public class ZorraAltar extends VirtualizedRegistry { + + @GroovyBlacklist + private static final Map managers = new Object2ObjectOpenHashMap<>(); + + ZorraAltar() { + managers.put("sword", ZorraAltarManager.SWORD); + managers.put("bow", ZorraAltarManager.BOW); + } + + public ZorraAltarManager createRegistry(String key) { + ZorraAltarManager manager = new ZorraAltarManager(); + managers.put(key, manager); + return manager; + } + + public ZorraAltarManager getRegistry(String key) { + return managers.get(key); + } + + @GroovyBlacklist + public void onReload() { + removeScripted().forEach(this::removeEnchantment); + restoreFromBackup().forEach(this::addEnchantment); + } + + private void addEnchantment(ZorraRecipeData recipe) { + if (!managers.containsKey(recipe.registry)) return; + managers.get(recipe.registry).addEnchant(recipe.enchantment, recipe.maxLevel); + } + + private void removeEnchantment(ZorraRecipeData recipe) { + if (!managers.containsKey(recipe.registry)) return; + managers.get(recipe.registry).removeEnchant(recipe.enchantment); + } + + @MethodDescription(example = { + @Example("'sword', enchantment('minecraft:power'), 10"), + @Example("'stick', enchantment('minecraft:knockback'), 20") + }) + public void addEnchantment(String registry, Enchantment enchantment, int maxLevel) { + if (!managers.containsKey(registry)) return; + managers.get(registry).addEnchant(enchantment, maxLevel); + addScripted(new ZorraRecipeData(registry, enchantment, maxLevel)); + } + + @MethodDescription(example = @Example("'sword', enchantment('minecraft:sharpness')")) + public boolean removeEnchantment(String registry, Enchantment enchantment) { + if (!managers.containsKey(registry)) return false; + int maxLevel = enchantment.getMaxLevel(); + if (maxLevel > 1) + maxLevel += Config.altarBonusLvl; + addBackup(new ZorraRecipeData(registry, enchantment, maxLevel)); + return managers.get(registry).removeEnchant(enchantment); + } + + @SuppressWarnings("ClassCanBeRecord") + public static final class ZorraRecipeData { + + private final String registry; + private final Enchantment enchantment; + private final int maxLevel; + + public ZorraRecipeData(String registry, Enchantment enchantment, int maxLevel) { + this.registry = registry; + this.enchantment = enchantment; + this.maxLevel = maxLevel; + } + + public String registry() { + return registry; + } + + public Enchantment enchantment() { + return enchantment; + } + + public int maxLevel() { + return maxLevel; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (ZorraRecipeData) obj; + return Objects.equals(this.registry, that.registry) && Objects.equals(this.enchantment, that.enchantment) && this.maxLevel == that.maxLevel; + } + + @Override + public int hashCode() { + return Objects.hash(registry, enchantment, maxLevel); + } + + @Override + public String toString() { + return "ZorraRecipeData[" + "registry=" + registry + ", " + "enchantment=" + enchantment + ", " + "maxLevel=" + maxLevel + ']'; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/ProjectE.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/ProjectE.java index b4fdac473..fec3f5a5f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/ProjectE.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/projecte/ProjectE.java @@ -6,5 +6,4 @@ public class ProjectE extends GroovyPropertyContainer { public final EntityRandomizer entityRandomizer = new EntityRandomizer(); public final Transmutation transmutation = new Transmutation(); - } 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 d490b66a9..3a0f5f006 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 @@ -79,7 +79,9 @@ public RecipeBuilder altOutput(IBlockState altOutput) { return this; } - @RecipeBuilderMethodDescription(field = {"output", "altOutput"}) + @RecipeBuilderMethodDescription(field = { + "output", "altOutput" + }) public RecipeBuilder output(IBlockState output, IBlockState altOutput) { this.output = output; this.altOutput = altOutput; @@ -104,7 +106,9 @@ public RecipeBuilder altOutput(Block altOutput) { return this; } - @RecipeBuilderMethodDescription(field = {"output", "altOutput"}) + @RecipeBuilderMethodDescription(field = { + "output", "altOutput" + }) public RecipeBuilder output(Block output, Block altOutput) { this.output = output.getDefaultState(); this.altOutput = altOutput.getDefaultState(); @@ -133,5 +137,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 d44c6fa77..c495e06d0 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 @@ -135,7 +135,7 @@ protected int getMaxItemInput() { // More than 1 item cannot be placed return 1; } - + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 810232082..24fa76931 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 @@ -19,8 +19,9 @@ public Barrel() { super(ModuleTechBasic.Registries.BARREL_RECIPE); } - @RecipeBuilderDescription(example = @Example( - ".input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:emerald')).fluidInput(fluid('water') * 1000).fluidOutput(fluid('amongium') * 1000).duration(1000).name('diamond_emerald_and_water_to_amongium')") + @RecipeBuilderDescription( + example = @Example( + ".input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:emerald')).fluidInput(fluid('water') * 1000).fluidOutput(fluid('amongium') * 1000).duration(1000).name('diamond_emerald_and_water_to_amongium')") ) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index dfd124d72..6a105eb61 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -6,18 +6,17 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; -import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; -import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CampfireRecipe; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; -import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneOvenRecipe; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; -@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.pyrotech.oven.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true)) +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.oven.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true)) public class BrickOven extends ForgeRegistryWrapper { public BrickOven() { 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 cb587dc36..48b256733 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 @@ -66,7 +66,9 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { public StoneOven() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserHerb.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserHerb.java index d3153ea94..2471eb2de 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserHerb.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserHerb.java @@ -34,5 +34,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), herb, info.isPrettyNbt()); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserModifier.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserModifier.java index 6536d6d9d..44ba61ec4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserModifier.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserModifier.java @@ -40,5 +40,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), modifier, info.isPrettyNbt()); InfoParserTranslationKey.instance.add(info.getMessages(), modifier.getTranslationKey(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserSpell.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserSpell.java index c74eef8bf..c08b46f8a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserSpell.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/InfoParserSpell.java @@ -42,5 +42,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), spell, info.isPrettyNbt()); InfoParserTranslationKey.instance.add(info.getMessages(), spell.getTranslationKey(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/LifeEssence.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/LifeEssence.java index fe22e79df..5f974529f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/LifeEssence.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/LifeEssence.java @@ -39,5 +39,4 @@ public boolean remove(EntityLivingBase entity) { public boolean remove(EntityEntry entity) { return remove((Class) entity.getEntityClass()); } - } 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 8fb57f9c7..7d9b443e8 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 @@ -156,49 +156,63 @@ public RecipeBuilder blue2(float blue2) { return this; } - @RecipeBuilderMethodDescription(field = {"red1", "red2"}) + @RecipeBuilderMethodDescription(field = { + "red1", "red2" + }) public RecipeBuilder red(float red1, float red2) { this.red1 = red1; this.red2 = red2; return this; } - @RecipeBuilderMethodDescription(field = {"red1", "red2"}) + @RecipeBuilderMethodDescription(field = { + "red1", "red2" + }) public RecipeBuilder red(float red) { this.red1 = red; this.red2 = red; return this; } - @RecipeBuilderMethodDescription(field = {"green1", "green2"}) + @RecipeBuilderMethodDescription(field = { + "green1", "green2" + }) public RecipeBuilder green(float green1, float green2) { this.green1 = green1; this.green2 = green2; return this; } - @RecipeBuilderMethodDescription(field = {"green1", "green2"}) + @RecipeBuilderMethodDescription(field = { + "green1", "green2" + }) public RecipeBuilder green(float green) { this.green1 = green; this.green2 = green; return this; } - @RecipeBuilderMethodDescription(field = {"blue1", "blue2"}) + @RecipeBuilderMethodDescription(field = { + "blue1", "blue2" + }) public RecipeBuilder blue(float blue1, float blue2) { this.blue1 = blue1; this.blue2 = blue2; return this; } - @RecipeBuilderMethodDescription(field = {"blue1", "blue2"}) + @RecipeBuilderMethodDescription(field = { + "blue1", "blue2" + }) public RecipeBuilder blue(float blue) { this.blue1 = blue; this.blue2 = blue; return this; } - @RecipeBuilderMethodDescription(field = {"red1", "green1", "blue1", "red2", "green2", "blue2"}) + @RecipeBuilderMethodDescription(field = { + "red1", "green1", "blue1", "red2", "green2", "blue2" + }) public RecipeBuilder color(float red1, float green1, float blue1, float red2, float green2, float blue2) { this.red1 = red1; this.red2 = red2; @@ -209,7 +223,9 @@ public RecipeBuilder color(float red1, float green1, float blue1, float red2, fl return this; } - @RecipeBuilderMethodDescription(field = {"red1", "green1", "blue1", "red2", "green2", "blue2"}) + @RecipeBuilderMethodDescription(field = { + "red1", "green1", "blue1", "red2", "green2", "blue2" + }) public RecipeBuilder color(float red, float green, float blue) { this.red1 = red; this.red2 = red; 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 9607c80a5..b4144c3ca 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 @@ -55,7 +55,6 @@ public static void reload() { MossConfigAccessor.getMossyStates().put(blockIn.getStateFromMeta(in.getMetadata()), blockOut.getStateFromMeta(out.getMetadata())); } } - } @MethodDescription(example = @Example("item('minecraft:stained_glass:3'), item('minecraft:stained_glass:4')"), type = MethodDescription.Type.ADDITION) 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 ca78b3b80..7f7dda88c 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 @@ -129,8 +129,8 @@ public void validate(GroovyLog.Msg msg) { BlockStateContainer container = blockstate.getBlock().getBlockState(); BlockStatePredicate predicate = properties.isEmpty() - ? new StatePredicate(blockstate) - : new PropertyPredicate(blockstate, properties.stream().map(container::getProperty).collect(Collectors.toList())); + ? new StatePredicate(blockstate) + : new PropertyPredicate(blockstate, properties.stream().map(container::getProperty).collect(Collectors.toList())); if (above) return new BlockStateAbove(predicate); if (below) return new BlockStateBelow(predicate); 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 1a979e63b..f0b1804bf 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 @@ -120,8 +120,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { @com.cleanroommc.groovyscript.api.documentation.annotations.Property(comp = @Comp(not = "null")) private SpellBase spell; - public RecipeBuilder() { - } + public RecipeBuilder() {} public RecipeBuilder(SpellBase spell) { this.spell = spell; @@ -312,4 +312,4 @@ public void validate(GroovyLog.Msg msg) { return epicsquid.roots.modifiers.Cost.of(list.toArray(new IModifierCost[0])); } } -} \ No newline at end of file +} 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 f98127a9e..86549993a 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 @@ -96,10 +96,7 @@ 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.contains(prop) && - current.contains(prop) && - state.get().getValue(prop).equals(output.getValue(prop))) + 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))) ) { addBackup(x.getValue()); return true; 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 386e44963..9680e3988 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 @@ -140,13 +140,17 @@ public void validate(GroovyLog.Msg msg) { public @Nullable ICondenserRecipe register() { if (!validate()) return null; - ICondenserRecipe recipe = new CondenserRecipe(output.get(0), input, modifier, bottle, - fluidInput.isEmpty() ? new FluidStack(FluidRegistry.WATER, 125) : fluidInput.getOrEmpty(0), - time, advanced); + ICondenserRecipe recipe = new CondenserRecipe( + output.get(0), + input, + modifier, + bottle, + fluidInput.isEmpty() ? new FluidStack(FluidRegistry.WATER, 125) : fluidInput.getOrEmpty(0), + time, + advanced); ModSupport.RUSTIC.get().alchemy.add(recipe); return recipe; } } - } 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 74e76a782..40a88ef49 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 @@ -75,5 +75,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 a9ef17ff0..f9ff0de47 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 @@ -48,8 +48,13 @@ public CondenserRecipe(@NotNull ItemStack output, List inputs, IIng } public CondenserRecipe( - @NotNull ItemStack output, List inputs, IIngredient modifier, IIngredient bottle, - @NotNull FluidStack fluid, int time, boolean advanced) { + @NotNull ItemStack output, + List inputs, + IIngredient modifier, + IIngredient bottle, + @NotNull FluidStack fluid, + int time, + boolean advanced) { this.output = output; this.fluid = fluid; this.bottle = bottle; @@ -61,10 +66,7 @@ public CondenserRecipe( @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()) { 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 d18ee789d..04614e851 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 @@ -30,7 +30,9 @@ public Collection getRecipes() { return Recipes.crushingTubRecipes; } - @MethodDescription(example = {@Example("fluid('ironberryjuice')"), @Example("item('minecraft:sugar')")}) + @MethodDescription(example = { + @Example("fluid('ironberryjuice')"), @Example("item('minecraft:sugar')") + }) public boolean removeByOutput(IIngredient output) { return getRecipes().removeIf(entry -> { if (output.test(entry.getResult()) || output.test(entry.getByproduct())) { @@ -94,5 +96,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 4ceb2ab15..f1db2c422 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,5 +95,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 458c4acdc..550f4f368 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 @@ -17,5 +17,4 @@ public ExtendedEvaporatingBasinRecipe(ItemStack out, FluidStack in, int time) { public int getTime() { return time; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Rustic.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Rustic.java index 631095f31..c864ea098 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Rustic.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Rustic.java @@ -8,5 +8,4 @@ public class Rustic extends GroovyPropertyContainer { public final BrewingBarrel brewingBarrel = new BrewingBarrel(); public final CrushingTub crushingTub = new CrushingTub(); public final EvaporatingBasin evaporatingBasin = new EvaporatingBasin(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/TinkersComplement.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/TinkersComplement.java index 916939ff0..494cad6f7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/TinkersComplement.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tcomplement/TinkersComplement.java @@ -6,5 +6,4 @@ public class TinkersComplement extends GroovyPropertyContainer { public final Melter melter = new Melter(); public final HighOven highOven = new HighOven(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGeneratorRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGeneratorRegistry.java index 991cecebb..3590c64d3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGeneratorRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGeneratorRegistry.java @@ -35,5 +35,4 @@ public void removeByInput(IIngredient input) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGenericTechRebornRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGenericTechRebornRegistry.java index a918f2228..176d13c91 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGenericTechRebornRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractGenericTechRebornRegistry.java @@ -36,5 +36,4 @@ public void removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractPraescriptumRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractPraescriptumRegistry.java index a005bce34..b553694b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractPraescriptumRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AbstractPraescriptumRegistry.java @@ -47,5 +47,4 @@ public void removeByOutput(IIngredient output) { return false; }); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AlloySmelter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AlloySmelter.java index cd841ace3..0d87819dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AlloySmelter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AlloySmelter.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AssemblingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AssemblingMachine.java index 32e8b97ce..4fc485554 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AssemblingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/AssemblingMachine.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/BlastFurnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/BlastFurnace.java index e5153457c..9d376a182 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/BlastFurnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/BlastFurnace.java @@ -88,5 +88,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Centrifuge.java index 46b254273..4ac86c021 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Centrifuge.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ChemicalReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ChemicalReactor.java index 4fc473686..1c6202912 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ChemicalReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ChemicalReactor.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Compressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Compressor.java index 0a89e9856..f689b4bb4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Compressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Compressor.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DieselGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DieselGenerator.java index f4a2cba94..35bb8f3ea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DieselGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DieselGenerator.java @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DistillationTower.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DistillationTower.java index bd459a3b6..89a878114 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DistillationTower.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/DistillationTower.java @@ -90,5 +90,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Extractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Extractor.java index 93c925ac0..7045aa674 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Extractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Extractor.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FluidReplicator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FluidReplicator.java index c8e5ca693..323d6b672 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FluidReplicator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FluidReplicator.java @@ -108,5 +108,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FusionReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FusionReactor.java index c8b848ec2..1bc808d12 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FusionReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/FusionReactor.java @@ -135,5 +135,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/GasTurbine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/GasTurbine.java index c8596894f..1b4e0b805 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/GasTurbine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/GasTurbine.java @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Grinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Grinder.java index ea1b5b60e..76454564f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Grinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Grinder.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ImplosionCompressor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ImplosionCompressor.java index a066f50c2..52b4a03e0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ImplosionCompressor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ImplosionCompressor.java @@ -80,5 +80,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialElectrolyzer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialElectrolyzer.java index d31dc5200..cda0fbe9c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialElectrolyzer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialElectrolyzer.java @@ -90,5 +90,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialGrinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialGrinder.java index 8aeb73d30..fbbf81970 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialGrinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialGrinder.java @@ -104,5 +104,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialSawmill.java index 8fb2411bf..e0f687eca 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/IndustrialSawmill.java @@ -103,5 +103,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlasmaGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlasmaGenerator.java index 9b25905c6..8a4e68e18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlasmaGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlasmaGenerator.java @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlateBendingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlateBendingMachine.java index 9a31abfeb..88bb9eac6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlateBendingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/PlateBendingMachine.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Scrapbox.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Scrapbox.java index 922889377..936ef5c16 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Scrapbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/Scrapbox.java @@ -71,5 +71,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SemiFluidGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SemiFluidGenerator.java index 7982f22cd..befe342c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SemiFluidGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SemiFluidGenerator.java @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SolidCanningMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SolidCanningMachine.java index e78b92bc0..c8874c7b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SolidCanningMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/SolidCanningMachine.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/TechReborn.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/TechReborn.java index ece8eb8a2..37dfac84f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/TechReborn.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/TechReborn.java @@ -30,5 +30,4 @@ public class TechReborn extends GroovyPropertyContainer { public final ThermalGenerator thermalGenerator = new ThermalGenerator(); public final VacuumFreezer vacuumFreezer = new VacuumFreezer(); public final WireMill wireMill = new WireMill(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ThermalGenerator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ThermalGenerator.java index 5f87cd88a..371663e09 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ThermalGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/ThermalGenerator.java @@ -79,5 +79,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/VacuumFreezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/VacuumFreezer.java index cd6790494..757662471 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/VacuumFreezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/VacuumFreezer.java @@ -78,5 +78,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/WireMill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/WireMill.java index 48ddc645e..5d3cfe9d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/WireMill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/techreborn/WireMill.java @@ -89,5 +89,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 e2a844294..fcb6dfb93 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 @@ -58,7 +58,6 @@ public CrucibleRecipe add(String researchKey, ItemStack result, IIngredient cata } public boolean remove(CrucibleRecipe recipe) { - Iterator recipeIterator = ThaumcraftApi.getCraftingRecipes().values().iterator(); Object r; 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 3941ef2b5..238712afe 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 @@ -59,13 +59,11 @@ 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)) { + } else if (trigger instanceof DustTriggerOre && registeredTrigger instanceof DustTriggerOre && trigger.equals(registeredTrigger)) { it.remove(); addBackup(trigger); found = true; @@ -81,12 +79,10 @@ 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))) { + } else if (trigger instanceof DustTriggerOre && oreTriggerResult != null && output.isItemEqual((ItemStack) oreTriggerResult.get(trigger))) { it.remove(); addBackup(trigger); } @@ -159,6 +155,5 @@ public void register() { ModSupport.THAUMCRAFT.get().dustTrigger.add(new DustTriggerSimple(research, target, output)); } } - } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfoParserAspect.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfoParserAspect.java index 93ae9f539..8a6b76810 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfoParserAspect.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfoParserAspect.java @@ -33,17 +33,17 @@ public String text(@NotNull AspectStack entry, boolean colored, boolean prettyNb public void parse(InfoParserPackage info) { if (info.getEntity() == null && info.getStack().isEmpty()) return; AspectList list = info.getStack().isEmpty() - ? AspectHelper.getEntityAspects(info.getEntity()) - : AspectHelper.getObjectAspects(info.getStack()); + ? AspectHelper.getEntityAspects(info.getEntity()) + : AspectHelper.getObjectAspects(info.getStack()); if (list == null) return; // convert it into groovyscript AspectStack, so we can easily represent quantity - List target = list.aspects.entrySet().stream() + List target = list.aspects.entrySet() + .stream() .map(x -> new AspectStack(x.getKey(), x.getValue())) .collect(Collectors.toList()); instance.add(info.getMessages(), target, info.isPrettyNbt()); } - } 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 b5931557f..95400cddb 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 @@ -131,7 +131,5 @@ public int getWeight() { public int getRarity() { return rarity; } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Research.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Research.java index db63c5e99..a4ca5cd55 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Research.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Research.java @@ -234,8 +234,8 @@ public ResearchCategoryBuilder background2(String mod, String background2) { @RecipeBuilderRegistrationMethod public ResearchCategory register() { ResearchCategory category = background2 == null - ? new ResearchCategory(key, researchKey, formula, icon, background) - : new ResearchCategory(key, researchKey, formula, icon, background, background2); + ? new ResearchCategory(key, researchKey, formula, icon, background) + : new ResearchCategory(key, researchKey, formula, icon, background, background2); ModSupport.THAUMCRAFT.get().research.addCategory(category); return category; 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 cdf34c899..13fa1472c 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 @@ -81,7 +81,8 @@ public String getRecipeNamePrefix() { @Override @RecipeBuilderRegistrationMethod public IRecipe register() { - GroovyLog.Msg msg = GroovyLog.msg("Error creating Thaumcraft Arcane Workbench recipe").error() + GroovyLog.Msg msg = GroovyLog.msg("Error creating Thaumcraft Arcane Workbench recipe") + .error() .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!"); if (msg.postIfNotEmpty()) return null; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneWorkbench.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneWorkbench.java index fbdb781e1..34eb588ca 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneWorkbench.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/arcane/ArcaneWorkbench.java @@ -50,7 +50,8 @@ public ArcaneRecipeBuilder.Shapeless shapelessBuilder() { @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { - List recipes = ForgeRegistries.RECIPES.getValuesCollection().stream() + List recipes = ForgeRegistries.RECIPES.getValuesCollection() + .stream() .filter(recipe -> recipe instanceof IArcaneRecipe) .map(recipe -> (IArcaneRecipe) recipe) .collect(Collectors.toList()); @@ -60,4 +61,3 @@ public void removeAll() { } } } - 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 433c1510b..f1b47a437 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 @@ -30,7 +30,9 @@ public class ShapelessArcaneCR extends ShapelessArcaneRecipe implements ICraftin private final ShapelessCraftingRecipe craftingRecipe; public ShapelessArcaneCR(ItemStack output, List input, @Nullable Closure recipeFunction, @Nullable Closure recipeAction, String research, int vis, AspectList crystals) { - super(ArcaneWorkbench.DEFAULT, research, vis, crystals, output, new Object[]{Ingredient.EMPTY}); + super(ArcaneWorkbench.DEFAULT, research, vis, crystals, output, new Object[]{ + Ingredient.EMPTY + }); this.craftingRecipe = new ShapelessCraftingRecipe(output, input, recipeFunction, recipeAction); } 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 b44a787f1..3d6ae4734 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 @@ -51,12 +51,10 @@ else if (aspectList.entity != null) 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)) { + } else if (target instanceof ItemStack && scriptedAspect.item != null && ((ItemStack) target).isItemEqual(scriptedAspect.item)) { found.set(true); scriptedAspect.addAspect(aspect); } @@ -76,12 +74,10 @@ else if (target instanceof EntityEntry) 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)) { + } else if (target instanceof ItemStack && backupAspect.item != null && ((ItemStack) target).isItemEqual(backupAspect.item)) { found.set(true); backupAspect.addAspect(aspect); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectListHelper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectListHelper.java index 6d0404323..7602bf9bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectListHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/AspectListHelper.java @@ -64,5 +64,4 @@ public AspectList getAspectList() { return result; } - } 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 99218714f..3a61108a5 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 @@ -61,5 +61,4 @@ public int getWarp() { return warp; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/WarpItemStackExpansion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/WarpItemStackExpansion.java index e644dcf6f..ea7a37243 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/WarpItemStackExpansion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/warp/WarpItemStackExpansion.java @@ -12,5 +12,4 @@ public static void addWarp(ItemStack itemStack, int warp) { public static void clearWarp(ItemStack itemStack) { ModSupport.THAUMCRAFT.get().warp.removeWarp(itemStack); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/MoonlightForge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/MoonlightForge.java index 22ccb517c..d3532cc9c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/MoonlightForge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/MoonlightForge.java @@ -1,80 +1,80 @@ -package com.cleanroommc.groovyscript.compat.mods.theaurorian; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import com.shiroroku.theaurorian.Recipes.MoonlightForgeRecipe; -import com.shiroroku.theaurorian.Recipes.MoonlightForgeRecipeHandler; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; - -@RegistryDescription -public class MoonlightForge extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:stone_sword'), item('minecraft:diamond')).output(item('minecraft:diamond_sword'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - public Collection getRecipes() { - return MoonlightForgeRecipeHandler.allRecipes; - } - - @MethodDescription(example = @Example("item('theaurorian:moonstonesword'), item('theaurorian:aurorianiteingot')")) - public boolean removeByInput(IIngredient input, IIngredient catalyst) { - return getRecipes().removeIf(r -> { - if (input.test(r.getInput1()) && catalyst.test(r.getInput2())) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('theaurorian:queenschipper')")) - public boolean removeByOutput(IIngredient output) { - return getRecipes().removeIf(r -> { - if (output.test(r.getOutput())) { - addBackup(r); - return true; - } - return false; - }); - } - - @Property(property = "input", comp = @Comp(eq = 2)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Override - public String getErrorMsg() { - return "Error adding Moonlight Forge recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 2, 2, 1, 1); - validateFluids(msg); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable MoonlightForgeRecipe register() { - if (!validate()) return null; - MoonlightForgeRecipe recipe = null; - for (ItemStack input1 : input.get(0).getMatchingStacks()) { - for (ItemStack input2 : input.get(1).getMatchingStacks()) { - recipe = new MoonlightForgeRecipe(input1, input2, output.get(0)); - ModSupport.THE_AURORIAN.get().moonlightForge.add(recipe); - } - } - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.theaurorian; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import com.shiroroku.theaurorian.Recipes.MoonlightForgeRecipe; +import com.shiroroku.theaurorian.Recipes.MoonlightForgeRecipeHandler; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; + +@RegistryDescription +public class MoonlightForge extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:stone_sword'), item('minecraft:diamond')).output(item('minecraft:diamond_sword'))")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + public Collection getRecipes() { + return MoonlightForgeRecipeHandler.allRecipes; + } + + @MethodDescription(example = @Example("item('theaurorian:moonstonesword'), item('theaurorian:aurorianiteingot')")) + public boolean removeByInput(IIngredient input, IIngredient catalyst) { + return getRecipes().removeIf(r -> { + if (input.test(r.getInput1()) && catalyst.test(r.getInput2())) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('theaurorian:queenschipper')")) + public boolean removeByOutput(IIngredient output) { + return getRecipes().removeIf(r -> { + if (output.test(r.getOutput())) { + addBackup(r); + return true; + } + return false; + }); + } + + @Property(property = "input", comp = @Comp(eq = 2)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Override + public String getErrorMsg() { + return "Error adding Moonlight Forge recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 2, 2, 1, 1); + validateFluids(msg); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable MoonlightForgeRecipe register() { + if (!validate()) return null; + MoonlightForgeRecipe recipe = null; + for (ItemStack input1 : input.get(0).getMatchingStacks()) { + for (ItemStack input2 : input.get(1).getMatchingStacks()) { + recipe = new MoonlightForgeRecipe(input1, input2, output.get(0)); + ModSupport.THE_AURORIAN.get().moonlightForge.add(recipe); + } + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/Scrapper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/Scrapper.java index 89277a601..cb054b482 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/Scrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/Scrapper.java @@ -1,78 +1,78 @@ -package com.cleanroommc.groovyscript.compat.mods.theaurorian; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.ModSupport; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import com.shiroroku.theaurorian.Recipes.ScrapperRecipe; -import com.shiroroku.theaurorian.Recipes.ScrapperRecipeHandler; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; - -@RegistryDescription -public class Scrapper extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:stone_sword')).output(item('minecraft:cobblestone'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - public Collection getRecipes() { - return ScrapperRecipeHandler.allRecipes; - } - - @MethodDescription(example = @Example("item('minecraft:iron_sword')")) - public boolean removeByInput(IIngredient input) { - return getRecipes().removeIf(r -> { - if (input.test(r.getInput())) { - addBackup(r); - return true; - } - return false; - }); - } - - @MethodDescription(example = @Example("item('theaurorian:scrapaurorianite')")) - public boolean removeByOutput(IIngredient output) { - return getRecipes().removeIf(r -> { - if (output.test(r.getOutput())) { - addBackup(r); - return true; - } - return false; - }); - } - - @Property(property = "input", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public static class RecipeBuilder extends AbstractRecipeBuilder { - - @Override - public String getErrorMsg() { - return "Error adding Scrapper recipe"; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateItems(msg, 1, 1, 1, 1); - validateFluids(msg); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable ScrapperRecipe register() { - if (!validate()) return null; - ScrapperRecipe recipe = null; - for (ItemStack input1 : input.get(0).getMatchingStacks()) { - recipe = new ScrapperRecipe(input1, output.get(0)); - ModSupport.THE_AURORIAN.get().scrapper.add(recipe); - } - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.theaurorian; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import com.shiroroku.theaurorian.Recipes.ScrapperRecipe; +import com.shiroroku.theaurorian.Recipes.ScrapperRecipeHandler; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; + +@RegistryDescription +public class Scrapper extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:stone_sword')).output(item('minecraft:cobblestone'))")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + public Collection getRecipes() { + return ScrapperRecipeHandler.allRecipes; + } + + @MethodDescription(example = @Example("item('minecraft:iron_sword')")) + public boolean removeByInput(IIngredient input) { + return getRecipes().removeIf(r -> { + if (input.test(r.getInput())) { + addBackup(r); + return true; + } + return false; + }); + } + + @MethodDescription(example = @Example("item('theaurorian:scrapaurorianite')")) + public boolean removeByOutput(IIngredient output) { + return getRecipes().removeIf(r -> { + if (output.test(r.getOutput())) { + addBackup(r); + return true; + } + return false; + }); + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Override + public String getErrorMsg() { + return "Error adding Scrapper recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable ScrapperRecipe register() { + if (!validate()) return null; + ScrapperRecipe recipe = null; + for (ItemStack input1 : input.get(0).getMatchingStacks()) { + recipe = new ScrapperRecipe(input1, output.get(0)); + ModSupport.THE_AURORIAN.get().scrapper.add(recipe); + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/TheAurorian.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/TheAurorian.java index 88c979838..703644e3c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/TheAurorian.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/theaurorian/TheAurorian.java @@ -1,10 +1,9 @@ -package com.cleanroommc.groovyscript.compat.mods.theaurorian; - -import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; - -public class TheAurorian extends GroovyPropertyContainer { - - public final Scrapper scrapper = new Scrapper(); - public final MoonlightForge moonlightForge = new MoonlightForge(); - -} +package com.cleanroommc.groovyscript.compat.mods.theaurorian; + +import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; + +public class TheAurorian extends GroovyPropertyContainer { + + public final Scrapper scrapper = new Scrapper(); + public final MoonlightForge moonlightForge = new MoonlightForge(); +} 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 eec6f2438..1e90af3ef 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 @@ -15,8 +15,9 @@ import java.util.Objects; -@RegistryDescription(category = RegistryDescription.Category.ENTRIES, - admonition = @Admonition(value = "groovyscript.wiki.thermalexpansion.coolant.note0", type = Admonition.Type.WARNING)) +@RegistryDescription( + category = RegistryDescription.Category.ENTRIES, + admonition = @Admonition(value = "groovyscript.wiki.thermalexpansion.coolant.note0", type = Admonition.Type.WARNING)) public class Coolant extends VirtualizedRegistry { @Override @@ -80,7 +81,10 @@ public SimpleObjectStream streamRecipes() { @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { - CoolantManagerAccessor.getCoolantMap().keySet().stream().filter(CoolantManagerAccessor.getCoolantFactorMap()::containsKey) + CoolantManagerAccessor.getCoolantMap() + .keySet() + .stream() + .filter(CoolantManagerAccessor.getCoolantFactorMap()::containsKey) .forEach(x -> addBackup(new CoolantRecipe(x, CoolantManagerAccessor.getCoolantMap().getInt(x), CoolantManagerAccessor.getCoolantFactorMap().getInt(x)))); CoolantManagerAccessor.getCoolantMap().clear(); CoolantManagerAccessor.getCoolantFactorMap().clear(); @@ -116,9 +120,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (CoolantRecipe) obj; - return Objects.equals(this.fluid, that.fluid) && - this.rf == that.rf && - this.factor == that.factor; + return Objects.equals(this.fluid, that.fluid) && this.rf == that.rf && this.factor == that.factor; } @Override @@ -128,11 +130,7 @@ public int hashCode() { @Override public String toString() { - return "CoolantRecipe[" + - "fluid=" + fluid + ", " + - "rf=" + rf + ", " + - "factor=" + factor + ']'; + return "CoolantRecipe[" + "fluid=" + fluid + ", " + "rf=" + rf + ", " + "factor=" + factor + ']'; } } - } 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 0996ef76b..cc7d5c48a 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 @@ -70,7 +70,9 @@ public boolean remove(ItemStack input) { @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { - List list = DiffuserManagerAccessor.getReagentAmpMap().keySet().stream() + List list = DiffuserManagerAccessor.getReagentAmpMap() + .keySet() + .stream() .filter(DiffuserManagerAccessor.getReagentDurMap()::containsKey) .map(DiffuserRecipe::new) .collect(Collectors.toList()); @@ -79,7 +81,9 @@ public SimpleObjectStream streamRecipes() { @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { - DiffuserManagerAccessor.getReagentAmpMap().keySet().stream() + DiffuserManagerAccessor.getReagentAmpMap() + .keySet() + .stream() .filter(DiffuserManagerAccessor.getReagentDurMap()::containsKey) .map(DiffuserRecipe::new) .forEach(this::addBackup); @@ -121,9 +125,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (DiffuserRecipe) obj; - return Objects.equals(this.stack, that.stack) && - this.amplifier == that.amplifier && - this.duration == that.duration; + return Objects.equals(this.stack, that.stack) && this.amplifier == that.amplifier && this.duration == that.duration; } @Override @@ -133,11 +135,7 @@ public int hashCode() { @Override public String toString() { - return "DiffuserRecipe[" + - "stack=" + stack + ", " + - "amplifier=" + amplifier + ", " + - "duration=" + duration + ']'; + return "DiffuserRecipe[" + "stack=" + stack + ", " + "amplifier=" + amplifier + ", " + "duration=" + duration + ']'; } } - } 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 bf82f5a9c..a9d212de2 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 @@ -202,5 +202,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Fisher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Fisher.java index bf31f9767..f6542f790 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Fisher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Fisher.java @@ -115,8 +115,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (FisherRecipe) obj; - return Objects.equals(this.fish, that.fish) && - this.weight == that.weight; + return Objects.equals(this.fish, that.fish) && this.weight == that.weight; } @Override @@ -126,10 +125,7 @@ public int hashCode() { @Override public String toString() { - return "FisherRecipe[" + - "fish=" + fish + ", " + - "weight=" + weight + ']'; + return "FisherRecipe[" + "fish=" + fish + ", " + "weight=" + weight + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/FisherBait.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/FisherBait.java index 044ab25f8..f0bd764cd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/FisherBait.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/FisherBait.java @@ -92,8 +92,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (FisherRecipe) obj; - return Objects.equals(this.bait, that.bait) && - this.multiplier == that.multiplier; + return Objects.equals(this.bait, that.bait) && this.multiplier == that.multiplier; } @Override @@ -103,10 +102,7 @@ public int hashCode() { @Override public String toString() { - return "FisherRecipe[" + - "bait=" + bait + ", " + - "multiplier=" + multiplier + ']'; + return "FisherRecipe[" + "bait=" + bait + ", " + "multiplier=" + multiplier + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Tapper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Tapper.java index 4c3d78ba0..791d2071b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Tapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/Tapper.java @@ -179,8 +179,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (TapperItemRecipe) obj; - return Objects.equals(this.itemWrapper, that.itemWrapper) && - Objects.equals(this.fluidStack, that.fluidStack); + return Objects.equals(this.itemWrapper, that.itemWrapper) && Objects.equals(this.fluidStack, that.fluidStack); } @Override @@ -190,9 +189,7 @@ public int hashCode() { @Override public String toString() { - return "TapperItemRecipe[" + - "itemWrapper=" + itemWrapper + ", " + - "fluidStack=" + fluidStack + ']'; + return "TapperItemRecipe[" + "itemWrapper=" + itemWrapper + ", " + "fluidStack=" + fluidStack + ']'; } } @@ -220,8 +217,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (TapperBlockRecipe) obj; - return Objects.equals(this.blockWrapper, that.blockWrapper) && - Objects.equals(this.fluidStack, that.fluidStack); + return Objects.equals(this.blockWrapper, that.blockWrapper) && Objects.equals(this.fluidStack, that.fluidStack); } @Override @@ -231,10 +227,7 @@ public int hashCode() { @Override public String toString() { - return "TapperBlockRecipe[" + - "blockWrapper=" + blockWrapper + ", " + - "fluidStack=" + fluidStack + ']'; + return "TapperBlockRecipe[" + "blockWrapper=" + blockWrapper + ", " + "fluidStack=" + fluidStack + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperFertilizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperFertilizer.java index dc95fb224..a4e6e03b7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperFertilizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperFertilizer.java @@ -92,8 +92,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (TapperRecipe) obj; - return Objects.equals(this.bait, that.bait) && - this.multiplier == that.multiplier; + return Objects.equals(this.bait, that.bait) && this.multiplier == that.multiplier; } @Override @@ -103,10 +102,7 @@ public int hashCode() { @Override public String toString() { - return "TapperRecipe[" + - "bait=" + bait + ", " + - "multiplier=" + multiplier + ']'; + return "TapperRecipe[" + "bait=" + bait + ", " + "multiplier=" + multiplier + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperTree.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperTree.java index ab3e18f31..5b647b8a9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperTree.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/device/TapperTree.java @@ -117,8 +117,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (TapperTreeEntry) obj; - return Objects.equals(this.log, that.log) && - Objects.equals(this.leaf, that.leaf); + return Objects.equals(this.log, that.log) && Objects.equals(this.leaf, that.leaf); } @Override @@ -128,10 +127,7 @@ public int hashCode() { @Override public String toString() { - return "TapperTreeEntry[" + - "log=" + log + ", " + - "leaf=" + leaf + ']'; + return "TapperTreeEntry[" + "log=" + log + ", " + "leaf=" + leaf + ']'; } } - } 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 517639c47..15e39cb3a 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 @@ -43,9 +43,11 @@ public void add(ItemStack catalyst, int xp, int factor) { public boolean remove(ComparableItemStack comparableItemStack) { if (XpCollectorManagerAccessor.getCatalystMap().containsKey(comparableItemStack) && XpCollectorManagerAccessor.getCatalystFactorMap().containsKey(comparableItemStack)) { - addBackup(new XpCollectorRecipe(new ItemStack(comparableItemStack.item, comparableItemStack.metadata), - XpCollectorManagerAccessor.getCatalystMap().remove(comparableItemStack), - XpCollectorManagerAccessor.getCatalystFactorMap().remove(comparableItemStack))); + addBackup( + new XpCollectorRecipe( + new ItemStack(comparableItemStack.item, comparableItemStack.metadata), + XpCollectorManagerAccessor.getCatalystMap().remove(comparableItemStack), + XpCollectorManagerAccessor.getCatalystFactorMap().remove(comparableItemStack))); return true; } return false; @@ -77,7 +79,10 @@ public SimpleObjectStream streamRecipes() { @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { - XpCollectorManagerAccessor.getCatalystMap().keySet().stream().filter(XpCollectorManagerAccessor.getCatalystFactorMap()::containsKey) + XpCollectorManagerAccessor.getCatalystMap() + .keySet() + .stream() + .filter(XpCollectorManagerAccessor.getCatalystFactorMap()::containsKey) .forEach(x -> addBackup(new XpCollectorRecipe(new ItemStack(x.item, x.metadata), XpCollectorManagerAccessor.getCatalystMap().get(x), XpCollectorManagerAccessor.getCatalystFactorMap().get(x)))); XpCollectorManagerAccessor.getCatalystMap().clear(); XpCollectorManagerAccessor.getCatalystFactorMap().clear(); @@ -117,9 +122,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (XpCollectorRecipe) obj; - return Objects.equals(this.catalyst, that.catalyst) && - this.xp == that.xp && - this.factor == that.factor; + return Objects.equals(this.catalyst, that.catalyst) && this.xp == that.xp && this.factor == that.factor; } @Override @@ -129,11 +132,7 @@ public int hashCode() { @Override public String toString() { - return "XpCollectorRecipe[" + - "catalyst=" + catalyst + ", " + - "xp=" + xp + ", " + - "factor=" + factor + ']'; + return "XpCollectorRecipe[" + "catalyst=" + catalyst + ", " + "xp=" + xp + ", " + "factor=" + factor + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Compression.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Compression.java index ac6ad0ffb..303b84f9d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Compression.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Compression.java @@ -104,8 +104,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (CompressionRecipe) obj; - return Objects.equals(this.fluid, that.fluid) && - this.energy == that.energy; + return Objects.equals(this.fluid, that.fluid) && this.energy == that.energy; } @Override @@ -115,10 +114,7 @@ public int hashCode() { @Override public String toString() { - return "CompressionRecipe[" + - "fluid=" + fluid + ", " + - "energy=" + energy + ']'; + return "CompressionRecipe[" + "fluid=" + fluid + ", " + "energy=" + energy + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Enervation.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Enervation.java index f87fd9628..5f16d6a1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Enervation.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Enervation.java @@ -101,8 +101,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (EnervationRecipe) obj; - return Objects.equals(this.comparableItemStack, that.comparableItemStack) && - this.energy == that.energy; + return Objects.equals(this.comparableItemStack, that.comparableItemStack) && this.energy == that.energy; } @Override @@ -112,10 +111,7 @@ public int hashCode() { @Override public String toString() { - return "EnervationRecipe[" + - "comparableItemStack=" + comparableItemStack + ", " + - "energy=" + energy + ']'; + return "EnervationRecipe[" + "comparableItemStack=" + comparableItemStack + ", " + "energy=" + energy + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Lapidary.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Lapidary.java index 5fb2360a6..61817020d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Lapidary.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Lapidary.java @@ -101,8 +101,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (LapidaryRecipe) obj; - return Objects.equals(this.comparableItemStack, that.comparableItemStack) && - this.energy == that.energy; + return Objects.equals(this.comparableItemStack, that.comparableItemStack) && this.energy == that.energy; } @Override @@ -112,10 +111,7 @@ public int hashCode() { @Override public String toString() { - return "LapidaryRecipe[" + - "comparableItemStack=" + comparableItemStack + ", " + - "energy=" + energy + ']'; + return "LapidaryRecipe[" + "comparableItemStack=" + comparableItemStack + ", " + "energy=" + energy + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Magmatic.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Magmatic.java index d65802423..0b5d7932b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Magmatic.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Magmatic.java @@ -104,8 +104,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (MagmaticRecipe) obj; - return Objects.equals(this.fluid, that.fluid) && - this.energy == that.energy; + return Objects.equals(this.fluid, that.fluid) && this.energy == that.energy; } @Override @@ -115,10 +114,7 @@ public int hashCode() { @Override public String toString() { - return "MagmaticRecipe[" + - "fluid=" + fluid + ", " + - "energy=" + energy + ']'; + return "MagmaticRecipe[" + "fluid=" + fluid + ", " + "energy=" + energy + ']'; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Numismatic.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Numismatic.java index bfc4a90fe..57be9b66c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Numismatic.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Numismatic.java @@ -101,8 +101,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (NumismaticRecipe) obj; - return Objects.equals(this.comparableItemStack, that.comparableItemStack) && - this.energy == that.energy; + return Objects.equals(this.comparableItemStack, that.comparableItemStack) && this.energy == that.energy; } @Override @@ -112,10 +111,7 @@ public int hashCode() { @Override public String toString() { - return "NumismaticRecipe[" + - "comparableItemStack=" + comparableItemStack + ", " + - "energy=" + energy + ']'; + return "NumismaticRecipe[" + "comparableItemStack=" + comparableItemStack + ", " + "energy=" + energy + ']'; } } - } 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 cb90b3d45..7fe8aa24a 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 @@ -68,7 +68,9 @@ private List hash(ItemStack reactant, Fluid fluid) { return Arrays.asList((new ComparableItemStack(reactant)).hashCode(), fluid.getName().hashCode()); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = {@Example("item('minecraft:gunpowder')"), @Example("item('minecraft:clay')")}) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = { + @Example("item('minecraft:gunpowder')"), @Example("item('minecraft:clay')") + }) public boolean addElementalReactant(ItemStack itemStack) { return ReactantManagerAccessor.getValidReactantsElemental().add(new ComparableItemStack(itemStack)) && elementalReactantStorage.addScripted(itemStack); } @@ -185,5 +187,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Steam.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Steam.java index 2b770df8a..16176baf0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Steam.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thermalexpansion/dynamo/Steam.java @@ -101,8 +101,7 @@ public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (SteamRecipe) obj; - return Objects.equals(this.comparableItemStack, that.comparableItemStack) && - this.energy == that.energy; + return Objects.equals(this.comparableItemStack, that.comparableItemStack) && this.energy == that.energy; } @Override @@ -112,10 +111,7 @@ public int hashCode() { @Override public String toString() { - return "SteamRecipe[" + - "comparableItemStack=" + comparableItemStack + ", " + - "energy=" + energy + ']'; + return "SteamRecipe[" + "comparableItemStack=" + comparableItemStack + ", " + "energy=" + energy + ']'; } } - } 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 637839cfe..928d51d38 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 @@ -51,13 +51,15 @@ public void onReload() { @GroovyBlacklist public void afterScriptLoad() { BrewerManagerAccessor.getValidationSet().clear(); - BrewerManagerAccessor.getValidationSet().addAll( - BrewerManagerAccessor.getRecipeMap().values().stream().map(BrewerRecipe::getInput).map(BrewerManager::convertInput).collect(Collectors.toList()) - ); + BrewerManagerAccessor.getValidationSet() + .addAll( + BrewerManagerAccessor.getRecipeMap().values().stream().map(BrewerRecipe::getInput).map(BrewerManager::convertInput).collect(Collectors.toList()) + ); BrewerManagerAccessor.getValidationFluids().clear(); - BrewerManagerAccessor.getValidationFluids().addAll( - BrewerManagerAccessor.getRecipeMap().values().stream().map(BrewerRecipe::getInputFluid).map(FluidStack::getFluid).map(Fluid::getName).collect(Collectors.toList()) - ); + BrewerManagerAccessor.getValidationFluids() + .addAll( + BrewerManagerAccessor.getRecipeMap().values().stream().map(BrewerRecipe::getInputFluid).map(FluidStack::getFluid).map(Fluid::getName).collect(Collectors.toList()) + ); } private List hash(BrewerRecipe recipe) { 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 a4a772268..d094dafc9 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 @@ -77,7 +77,9 @@ public boolean removeByInput(IIngredient input) { }); } - @MethodDescription(example = {@Example("fluid('redstone')"), @Example("item('minecraft:redstone')")}) + @MethodDescription(example = { + @Example("fluid('redstone')"), @Example("item('minecraft:redstone')") + }) public boolean removeByOutput(IIngredient output) { return CentrifugeManagerAccessor.getRecipeMap().values().removeIf(r -> { if (output.test(r.getFluid()) || r.getOutput().stream().anyMatch(output)) { 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 ed70f7e4f..2e95bd31d 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 @@ -45,11 +45,15 @@ public void onReload() { @ApiStatus.Internal public void afterScriptLoad() { CrucibleManagerAccessor.getLavaSet().clear(); - CrucibleManagerAccessor.getLavaSet().addAll(CrucibleManagerAccessor.getRecipeMap().values().stream() - .filter(x -> x.getOutput().getFluid() == FluidRegistry.LAVA) - .map(CrucibleRecipe::getInput) - .map(CrucibleManager::convertInput) - .collect(Collectors.toList())); + CrucibleManagerAccessor.getLavaSet() + .addAll( + CrucibleManagerAccessor.getRecipeMap() + .values() + .stream() + .filter(x -> x.getOutput().getFluid() == FluidRegistry.LAVA) + .map(CrucibleRecipe::getInput) + .map(CrucibleManager::convertInput) + .collect(Collectors.toList())); } public void add(CrucibleRecipe recipe) { 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 d3348702c..a3e2320e8 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 @@ -59,12 +59,14 @@ private List hash(ItemStack primaryInput, ItemS @ApiStatus.Internal public void afterScriptLoad() { EnchanterManagerAccessor.getValidationSet().clear(); - EnchanterManagerAccessor.getValidationSet().addAll( - EnchanterManagerAccessor.getRecipeMap().values().stream().map(EnchanterRecipe::getPrimaryInput).map(EnchanterManager::convertInput).collect(Collectors.toList()) - ); - EnchanterManagerAccessor.getValidationSet().addAll( - EnchanterManagerAccessor.getRecipeMap().values().stream().map(EnchanterRecipe::getSecondaryInput).map(EnchanterManager::convertInput).collect(Collectors.toList()) - ); + EnchanterManagerAccessor.getValidationSet() + .addAll( + EnchanterManagerAccessor.getRecipeMap().values().stream().map(EnchanterRecipe::getPrimaryInput).map(EnchanterManager::convertInput).collect(Collectors.toList()) + ); + EnchanterManagerAccessor.getValidationSet() + .addAll( + EnchanterManagerAccessor.getRecipeMap().values().stream().map(EnchanterRecipe::getSecondaryInput).map(EnchanterManager::convertInput).collect(Collectors.toList()) + ); } @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:clay')")) 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 511fb56ad..a8b4205ae 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 @@ -49,13 +49,15 @@ public void onReload() { @ApiStatus.Internal public void afterScriptLoad() { ExtruderManagerAccessor.getOutputListIgneous().clear(); - ExtruderManagerAccessor.getOutputListIgneous().addAll( - ExtruderManagerAccessor.getRecipeMapIgneous().values().stream().map(ExtruderRecipe::getOutput).collect(Collectors.toList()) - ); + ExtruderManagerAccessor.getOutputListIgneous() + .addAll( + ExtruderManagerAccessor.getRecipeMapIgneous().values().stream().map(ExtruderRecipe::getOutput).collect(Collectors.toList()) + ); ExtruderManagerAccessor.getOutputListSedimentary().clear(); - ExtruderManagerAccessor.getOutputListSedimentary().addAll( - ExtruderManagerAccessor.getRecipeMapSedimentary().values().stream().map(ExtruderRecipe::getOutput).collect(Collectors.toList()) - ); + ExtruderManagerAccessor.getOutputListSedimentary() + .addAll( + ExtruderManagerAccessor.getRecipeMapSedimentary().values().stream().map(ExtruderRecipe::getOutput).collect(Collectors.toList()) + ); } private Map map(boolean isSedimentary) { 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 402299454..1dd78377d 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 @@ -58,12 +58,14 @@ private List hash(ItemStack primaryInput, ItemS @ApiStatus.Internal public void afterScriptLoad() { InsolatorManagerAccessor.getValidationSet().clear(); - InsolatorManagerAccessor.getValidationSet().addAll( - InsolatorManagerAccessor.getRecipeMap().values().stream().map(InsolatorRecipe::getPrimaryInput).map(InsolatorManager::convertInput).collect(Collectors.toList()) - ); - InsolatorManagerAccessor.getValidationSet().addAll( - InsolatorManagerAccessor.getRecipeMap().values().stream().map(InsolatorRecipe::getSecondaryInput).map(InsolatorManager::convertInput).collect(Collectors.toList()) - ); + InsolatorManagerAccessor.getValidationSet() + .addAll( + InsolatorManagerAccessor.getRecipeMap().values().stream().map(InsolatorRecipe::getPrimaryInput).map(InsolatorManager::convertInput).collect(Collectors.toList()) + ); + InsolatorManagerAccessor.getValidationSet() + .addAll( + InsolatorManagerAccessor.getRecipeMap().values().stream().map(InsolatorRecipe::getSecondaryInput).map(InsolatorManager::convertInput).collect(Collectors.toList()) + ); } @MethodDescription(type = MethodDescription.Type.ADDITION) @@ -215,7 +217,6 @@ public void validate(GroovyLog.Msg msg) { ModSupport.THERMAL_EXPANSION.get().insolator.add(recipe1); if (recipe == null) recipe = recipe1; } - } return recipe; } 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 369de4952..9d15a3a95 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 @@ -45,9 +45,10 @@ public void onReload() { @ApiStatus.Internal public void afterScriptLoad() { PrecipitatorManagerAccessor.getOutputList().clear(); - PrecipitatorManagerAccessor.getOutputList().addAll( - PrecipitatorManagerAccessor.getRecipeMap().values().stream().map(PrecipitatorManager.PrecipitatorRecipe::getOutput).collect(Collectors.toList()) - ); + PrecipitatorManagerAccessor.getOutputList() + .addAll( + PrecipitatorManagerAccessor.getRecipeMap().values().stream().map(PrecipitatorManager.PrecipitatorRecipe::getOutput).collect(Collectors.toList()) + ); } public void add(PrecipitatorRecipe recipe) { 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 b8ba9ea47..3daa589ac 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 @@ -43,13 +43,15 @@ public void onReload() { @GroovyBlacklist public void afterScriptLoad() { TransposerManagerAccessor.getValidationSet().clear(); - TransposerManagerAccessor.getValidationSet().addAll( - TransposerManagerAccessor.getRecipeMapExtract().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) - ); + TransposerManagerAccessor.getValidationSet() + .addAll( + TransposerManagerAccessor.getRecipeMapExtract().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) + ); TransposerManagerAccessor.getValidationSet().clear(); - TransposerManagerAccessor.getValidationSet().addAll( - TransposerManagerAccessor.getRecipeMapFill().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) - ); + TransposerManagerAccessor.getValidationSet() + .addAll( + TransposerManagerAccessor.getRecipeMapFill().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) + ); } public void add(TransposerRecipe recipe) { 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 26b404a39..3f00d065b 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 @@ -46,13 +46,15 @@ public void onReload() { @GroovyBlacklist public void afterScriptLoad() { TransposerManagerAccessor.getValidationSet().clear(); - TransposerManagerAccessor.getValidationSet().addAll( - TransposerManagerAccessor.getRecipeMapExtract().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) - ); + TransposerManagerAccessor.getValidationSet() + .addAll( + TransposerManagerAccessor.getRecipeMapExtract().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) + ); TransposerManagerAccessor.getValidationSet().clear(); - TransposerManagerAccessor.getValidationSet().addAll( - TransposerManagerAccessor.getRecipeMapFill().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) - ); + TransposerManagerAccessor.getValidationSet() + .addAll( + TransposerManagerAccessor.getRecipeMapFill().values().stream().map(TransposerManager.TransposerRecipe::getInput).map(TransposerManager::convertInput).collect(Collectors.toList()) + ); } private List hash(TransposerRecipe recipe) { 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 8f5a7d3aa..ada10c19e 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 @@ -1,144 +1,151 @@ -package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.MeltingRecipeBuilder; -import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; -import com.cleanroommc.groovyscript.helper.Alias; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.Nullable; -import slimeknights.tconstruct.library.smeltery.CastingRecipe; -import slimeknights.tconstruct.library.smeltery.ICastingRecipe; - -import java.util.Collection; - -@RegistryDescription -public class CastingBasin extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).output(item('minecraft:dirt')).cast(item('minecraft:cobblestone')).coolingTime(40)")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - public CastingBasin() { - super(Alias.generateOfClass(CastingBasin.class).andGenerate("Basin")); - } - - @Override - public Collection getRecipes() { - return TinkerRegistryAccessor.getBasinCastRegistry(); - } - - @MethodDescription(example = @Example("item('minecraft:iron_block')")) - public boolean removeByOutput(ItemStack output) { - if (getRecipes().removeIf(recipe -> { - boolean found = ItemStack.areItemStacksEqual(recipe.getResult(ItemStack.EMPTY, FluidRegistry.WATER), output); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") - .add("could not find recipe with output {}", output) - .error() - .post(); - return false; - } - - @MethodDescription(example = @Example("fluid('clay')")) - public boolean removeByInput(FluidStack input) { - if (getRecipes().removeIf(recipe -> { - boolean found = recipe.getFluid(ItemStack.EMPTY, input.getFluid()).isFluidEqual(input); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") - .add("could not find recipe with input {}", input) - .error() - .post(); - return false; - } - - @MethodDescription(example = @Example("item('minecraft:planks:0')")) - public boolean removeByCast(IIngredient cast) { - ItemStack castStack = cast.getMatchingStacks()[0]; - if (getRecipes().removeIf(recipe -> { - boolean found = recipe.matches(castStack, recipe.getFluid(castStack, FluidRegistry.WATER).getFluid()); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") - .add("could not find recipe with cast {}", cast) - .error() - .post(); - return false; - } - - @Property(property = "fluidInput", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public class RecipeBuilder extends AbstractRecipeBuilder { - - @Property - private IIngredient cast; - @Property(defaultValue = "200", comp = @Comp(gte = 1)) - private int time = 200; - @Property - private boolean consumesCast; - - @RecipeBuilderMethodDescription(field = "time") - public RecipeBuilder coolingTime(int time) { - this.time = Math.max(time, 1); - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder consumesCast(boolean consumesCast) { - this.consumesCast = consumesCast; - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder consumesCast() { - return consumesCast(!consumesCast); - } - - @RecipeBuilderMethodDescription - public RecipeBuilder cast(IIngredient ingredient) { - this.cast = ingredient; - return this; - } - - @Override - public String getErrorMsg() { - return "Error adding Tinkers Construct Casting Basin recipe"; - } - - @Override - protected int getMaxItemInput() { - // More than 1 item cannot be placed - return 1; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateFluids(msg, 1, 1, 0, 0); - validateItems(msg, 0, 0, 1, 1); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable ICastingRecipe register() { - if (!validate()) return null; - CastingRecipe recipe = new CastingRecipe(output.get(0), cast != null ? MeltingRecipeBuilder.recipeMatchFromIngredient(cast) - : null, fluidInput.get(0), time, consumesCast, false); - add(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.MeltingRecipeBuilder; +import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; +import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; +import slimeknights.tconstruct.library.smeltery.CastingRecipe; +import slimeknights.tconstruct.library.smeltery.ICastingRecipe; + +import java.util.Collection; + +@RegistryDescription +public class CastingBasin extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('water')).output(item('minecraft:dirt')).cast(item('minecraft:cobblestone')).coolingTime(40)")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + public CastingBasin() { + super(Alias.generateOfClass(CastingBasin.class).andGenerate("Basin")); + } + + @Override + public Collection getRecipes() { + return TinkerRegistryAccessor.getBasinCastRegistry(); + } + + @MethodDescription(example = @Example("item('minecraft:iron_block')")) + public boolean removeByOutput(ItemStack output) { + if (getRecipes().removeIf(recipe -> { + boolean found = ItemStack.areItemStacksEqual(recipe.getResult(ItemStack.EMPTY, FluidRegistry.WATER), output); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") + .add("could not find recipe with output {}", output) + .error() + .post(); + return false; + } + + @MethodDescription(example = @Example("fluid('clay')")) + public boolean removeByInput(FluidStack input) { + if (getRecipes().removeIf(recipe -> { + boolean found = recipe.getFluid(ItemStack.EMPTY, input.getFluid()).isFluidEqual(input); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") + .add("could not find recipe with input {}", input) + .error() + .post(); + return false; + } + + @MethodDescription(example = @Example("item('minecraft:planks:0')")) + public boolean removeByCast(IIngredient cast) { + ItemStack castStack = cast.getMatchingStacks()[0]; + if (getRecipes().removeIf(recipe -> { + boolean found = recipe.matches(castStack, recipe.getFluid(castStack, FluidRegistry.WATER).getFluid()); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Basin recipe") + .add("could not find recipe with cast {}", cast) + .error() + .post(); + return false; + } + + @Property(property = "fluidInput", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public class RecipeBuilder extends AbstractRecipeBuilder { + + @Property + private IIngredient cast; + @Property(defaultValue = "200", comp = @Comp(gte = 1)) + private int time = 200; + @Property + private boolean consumesCast; + + @RecipeBuilderMethodDescription(field = "time") + public RecipeBuilder coolingTime(int time) { + this.time = Math.max(time, 1); + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder consumesCast(boolean consumesCast) { + this.consumesCast = consumesCast; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder consumesCast() { + return consumesCast(!consumesCast); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder cast(IIngredient ingredient) { + this.cast = ingredient; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Tinkers Construct Casting Basin recipe"; + } + + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateFluids(msg, 1, 1, 0, 0); + validateItems(msg, 0, 0, 1, 1); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable ICastingRecipe register() { + if (!validate()) return null; + CastingRecipe recipe = new CastingRecipe( + output.get(0), + cast != null + ? MeltingRecipeBuilder.recipeMatchFromIngredient(cast) + : null, + fluidInput.get(0), + time, + consumesCast, + false); + add(recipe); + return recipe; + } + } +} 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 157d80a2e..36c4438a7 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 @@ -1,143 +1,150 @@ -package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; - -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.IIngredient; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.MeltingRecipeBuilder; -import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; -import com.cleanroommc.groovyscript.helper.Alias; -import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; -import com.cleanroommc.groovyscript.registry.StandardListRegistry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import org.jetbrains.annotations.Nullable; -import slimeknights.tconstruct.library.smeltery.CastingRecipe; -import slimeknights.tconstruct.library.smeltery.ICastingRecipe; - -import java.util.Collection; - -@RegistryDescription -public class CastingTable extends StandardListRegistry { - - @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('lava') * 50).output(item('minecraft:diamond')).coolingTime(750).consumesCast(true).cast(ore('gemEmerald'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - public CastingTable() { - super(Alias.generateOfClass(CastingTable.class).andGenerate("Table")); - } - - @Override - public Collection getRecipes() { - return TinkerRegistryAccessor.getTableCastRegistry(); - } - - @MethodDescription(example = @Example("item('minecraft:gold_ingot')")) - public boolean removeByOutput(ItemStack output) { - if (getRecipes().removeIf(recipe -> { - boolean found = recipe.getResult(ItemStack.EMPTY, FluidRegistry.WATER).isItemEqual(output); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") - .add("could not find recipe with output {}", output) - .error() - .post(); - return false; - } - - @MethodDescription(example = @Example("fluid('iron')")) - public boolean removeByInput(FluidStack input) { - if (getRecipes().removeIf(recipe -> { - boolean found = recipe.getFluid(ItemStack.EMPTY, input.getFluid()).isFluidEqual(input); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") - .add("could not find recipe with input {}", input) - .error() - .post(); - return false; - } - - @MethodDescription(example = @Example("item('minecraft:bucket')")) - public boolean removeByCast(IIngredient cast) { - if (getRecipes().removeIf(recipe -> { - boolean found = recipe.matches(cast.getMatchingStacks()[0], recipe.getFluid(cast.getMatchingStacks()[0], FluidRegistry.WATER).getFluid()); - if (found) addBackup(recipe); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") - .add("could not find recipe with cast {}", cast) - .error() - .post(); - return false; - } - - @Property(property = "fluidInput", comp = @Comp(eq = 1)) - @Property(property = "output", comp = @Comp(eq = 1)) - public class RecipeBuilder extends AbstractRecipeBuilder { - - @Property - private IIngredient cast; - @Property(defaultValue = "200", comp = @Comp(gte = 1)) - private int time = 200; - @Property - private boolean consumesCast; - - @RecipeBuilderMethodDescription(field = "time") - public RecipeBuilder coolingTime(int time) { - this.time = Math.max(time, 1); - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder consumesCast(boolean consumesCast) { - this.consumesCast = consumesCast; - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder consumesCast() { - return consumesCast(!consumesCast); - } - - @RecipeBuilderMethodDescription - public RecipeBuilder cast(IIngredient ingredient) { - this.cast = ingredient; - return this; - } - - @Override - public String getErrorMsg() { - return "Error adding Tinkers Construct Casting Table recipe"; - } - - @Override - protected int getMaxItemInput() { - // More than 1 item cannot be placed - return 1; - } - - @Override - public void validate(GroovyLog.Msg msg) { - validateFluids(msg, 1, 1, 0, 0); - validateItems(msg, 0, 0, 1, 1); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable ICastingRecipe register() { - if (!validate()) return null; - CastingRecipe recipe = new CastingRecipe(output.get(0), cast != null ? MeltingRecipeBuilder.recipeMatchFromIngredient(cast) - : null, fluidInput.get(0), time, consumesCast, false); - add(recipe); - return recipe; - } - } -} \ No newline at end of file +package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.MeltingRecipeBuilder; +import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; +import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.StandardListRegistry; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; +import slimeknights.tconstruct.library.smeltery.CastingRecipe; +import slimeknights.tconstruct.library.smeltery.ICastingRecipe; + +import java.util.Collection; + +@RegistryDescription +public class CastingTable extends StandardListRegistry { + + @RecipeBuilderDescription(example = @Example(".fluidInput(fluid('lava') * 50).output(item('minecraft:diamond')).coolingTime(750).consumesCast(true).cast(ore('gemEmerald'))")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + public CastingTable() { + super(Alias.generateOfClass(CastingTable.class).andGenerate("Table")); + } + + @Override + public Collection getRecipes() { + return TinkerRegistryAccessor.getTableCastRegistry(); + } + + @MethodDescription(example = @Example("item('minecraft:gold_ingot')")) + public boolean removeByOutput(ItemStack output) { + if (getRecipes().removeIf(recipe -> { + boolean found = recipe.getResult(ItemStack.EMPTY, FluidRegistry.WATER).isItemEqual(output); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") + .add("could not find recipe with output {}", output) + .error() + .post(); + return false; + } + + @MethodDescription(example = @Example("fluid('iron')")) + public boolean removeByInput(FluidStack input) { + if (getRecipes().removeIf(recipe -> { + boolean found = recipe.getFluid(ItemStack.EMPTY, input.getFluid()).isFluidEqual(input); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") + .add("could not find recipe with input {}", input) + .error() + .post(); + return false; + } + + @MethodDescription(example = @Example("item('minecraft:bucket')")) + public boolean removeByCast(IIngredient cast) { + if (getRecipes().removeIf(recipe -> { + boolean found = recipe.matches(cast.getMatchingStacks()[0], recipe.getFluid(cast.getMatchingStacks()[0], FluidRegistry.WATER).getFluid()); + if (found) addBackup(recipe); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Casting Table recipe") + .add("could not find recipe with cast {}", cast) + .error() + .post(); + return false; + } + + @Property(property = "fluidInput", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + public class RecipeBuilder extends AbstractRecipeBuilder { + + @Property + private IIngredient cast; + @Property(defaultValue = "200", comp = @Comp(gte = 1)) + private int time = 200; + @Property + private boolean consumesCast; + + @RecipeBuilderMethodDescription(field = "time") + public RecipeBuilder coolingTime(int time) { + this.time = Math.max(time, 1); + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder consumesCast(boolean consumesCast) { + this.consumesCast = consumesCast; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder consumesCast() { + return consumesCast(!consumesCast); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder cast(IIngredient ingredient) { + this.cast = ingredient; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Tinkers Construct Casting Table recipe"; + } + + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateFluids(msg, 1, 1, 0, 0); + validateItems(msg, 0, 0, 1, 1); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable ICastingRecipe register() { + if (!validate()) return null; + CastingRecipe recipe = new CastingRecipe( + output.get(0), + cast != null + ? MeltingRecipeBuilder.recipeMatchFromIngredient(cast) + : null, + fluidInput.get(0), + time, + consumesCast, + false); + add(recipe); + return recipe; + } + } +} 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 0231b0278..8d9b686e4 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 @@ -1,160 +1,160 @@ -package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; - -import com.cleanroommc.groovyscript.api.GroovyBlacklist; -import com.cleanroommc.groovyscript.api.GroovyLog; -import com.cleanroommc.groovyscript.api.documentation.annotations.*; -import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.EntityMeltingRecipe; -import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; -import com.cleanroommc.groovyscript.helper.SimpleObjectStream; -import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; -import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; -import net.minecraft.entity.EntityList; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.registry.EntityEntry; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.stream.Collectors; - -@RegistryDescription -public class EntityMelting extends VirtualizedRegistry { - - @RecipeBuilderDescription(example = @Example(".fluidOutput(fluid('iron') * 500).input(resource('minecraft:pig'))")) - public RecipeBuilder recipeBuilder() { - return new RecipeBuilder(); - } - - @Override - @GroovyBlacklist - public void onReload() { - removeScripted().forEach(recipe -> TinkerRegistryAccessor.getEntityMeltingRegistry().remove(recipe.name, recipe.result)); - restoreFromBackup().forEach(recipe -> TinkerRegistryAccessor.getEntityMeltingRegistry().put(recipe.name, recipe.result)); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - protected List getAllRecipes() { - return TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().stream().map(EntityMeltingRecipe::fromMapEntry).collect(Collectors.toList()); - } - - public EntityMeltingRecipe add(EntityEntry entity, FluidStack output) { - EntityMeltingRecipe recipe = new EntityMeltingRecipe(entity, output); - add(recipe); - return recipe; - } - - public void add(EntityMeltingRecipe recipe) { - if (recipe == null || recipe.name == null) return; - addScripted(recipe); - TinkerRegistryAccessor.getEntityMeltingRegistry().put(recipe.name, recipe.result); - } - - public boolean remove(EntityMeltingRecipe recipe) { - if (recipe == null || recipe.name == null) return false; - addBackup(recipe); - TinkerRegistryAccessor.getEntityMeltingRegistry().remove(recipe.name, recipe.result); - return true; - } - - @MethodDescription - public boolean removeByInput(EntityEntry entity) { - ResourceLocation name = entity.getRegistryName(); - if (TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().removeIf(entry -> { - boolean found = entry.getKey().equals(name); - if (found) addBackup(new EntityMeltingRecipe(entry.getKey(), entry.getValue())); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Entity Melting recipe") - .add("could not find recipe with input {}", name) - .error() - .post(); - return false; - } - - @MethodDescription - public boolean removeByOutput(FluidStack output) { - if (TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().removeIf(entry -> { - boolean found = entry.getValue().isFluidEqual(output); - if (found) addBackup(new EntityMeltingRecipe(entry.getKey(), entry.getValue())); - return found; - })) return true; - - GroovyLog.msg("Error removing Tinkers Construct Entity Melting recipe") - .add("could not find recipe with output {}", output) - .error() - .post(); - return false; - } - - @MethodDescription(priority = 2000, example = @Example(commented = true)) - public void removeAll() { - TinkerRegistryAccessor.getEntityMeltingRegistry().forEach((name, result) -> addBackup(new EntityMeltingRecipe(name, result))); - TinkerRegistryAccessor.getEntityMeltingRegistry().clear(); - } - - @MethodDescription(type = MethodDescription.Type.QUERY) - public SimpleObjectStream streamRecipes() { - return new SimpleObjectStream<>(getAllRecipes()).setRemover(this::remove); - } - - public class RecipeBuilder implements IRecipeBuilder { - - @Property(comp = @Comp(not = "null")) - private FluidStack output; - @Property(comp = @Comp(not = "null")) - private ResourceLocation input; - - @RecipeBuilderMethodDescription(field = "output") - public RecipeBuilder fluidOutput(FluidStack stack) { - this.output = stack; - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder input(ResourceLocation name) { - this.input = name; - return this; - } - - @RecipeBuilderMethodDescription - public RecipeBuilder input(String name) { - return input(new ResourceLocation(name)); - } - - @RecipeBuilderMethodDescription - public RecipeBuilder input(String modid, String name) { - return input(new ResourceLocation(modid, name)); - } - - @RecipeBuilderMethodDescription - public RecipeBuilder input(EntityEntry entity) { - return input(entity.getRegistryName()); - } - - 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); - msg.add(output == null || output.amount < 1, "Expected 1 output fluid but found none!"); - } - - @Override - public boolean validate() { - GroovyLog.Msg msg = GroovyLog.msg(this.getErrorMsg()).error(); - this.validate(msg); - return !msg.postIfNotEmpty(); - } - - @Override - @RecipeBuilderRegistrationMethod - public @Nullable EntityMeltingRecipe register() { - if (!validate()) return null; - EntityMeltingRecipe recipe = new EntityMeltingRecipe(input, output); - add(recipe); - return recipe; - } - } -} +package com.cleanroommc.groovyscript.compat.mods.tinkersconstruct; + +import com.cleanroommc.groovyscript.api.GroovyBlacklist; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.recipe.EntityMeltingRecipe; +import com.cleanroommc.groovyscript.core.mixin.tconstruct.TinkerRegistryAccessor; +import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; +import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; +import net.minecraft.entity.EntityList; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.registry.EntityEntry; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.stream.Collectors; + +@RegistryDescription +public class EntityMelting extends VirtualizedRegistry { + + @RecipeBuilderDescription(example = @Example(".fluidOutput(fluid('iron') * 500).input(resource('minecraft:pig'))")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @Override + @GroovyBlacklist + public void onReload() { + removeScripted().forEach(recipe -> TinkerRegistryAccessor.getEntityMeltingRegistry().remove(recipe.name, recipe.result)); + restoreFromBackup().forEach(recipe -> TinkerRegistryAccessor.getEntityMeltingRegistry().put(recipe.name, recipe.result)); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + protected List getAllRecipes() { + return TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().stream().map(EntityMeltingRecipe::fromMapEntry).collect(Collectors.toList()); + } + + public EntityMeltingRecipe add(EntityEntry entity, FluidStack output) { + EntityMeltingRecipe recipe = new EntityMeltingRecipe(entity, output); + add(recipe); + return recipe; + } + + public void add(EntityMeltingRecipe recipe) { + if (recipe == null || recipe.name == null) return; + addScripted(recipe); + TinkerRegistryAccessor.getEntityMeltingRegistry().put(recipe.name, recipe.result); + } + + public boolean remove(EntityMeltingRecipe recipe) { + if (recipe == null || recipe.name == null) return false; + addBackup(recipe); + TinkerRegistryAccessor.getEntityMeltingRegistry().remove(recipe.name, recipe.result); + return true; + } + + @MethodDescription + public boolean removeByInput(EntityEntry entity) { + ResourceLocation name = entity.getRegistryName(); + if (TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().removeIf(entry -> { + boolean found = entry.getKey().equals(name); + if (found) addBackup(new EntityMeltingRecipe(entry.getKey(), entry.getValue())); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Entity Melting recipe") + .add("could not find recipe with input {}", name) + .error() + .post(); + return false; + } + + @MethodDescription + public boolean removeByOutput(FluidStack output) { + if (TinkerRegistryAccessor.getEntityMeltingRegistry().entrySet().removeIf(entry -> { + boolean found = entry.getValue().isFluidEqual(output); + if (found) addBackup(new EntityMeltingRecipe(entry.getKey(), entry.getValue())); + return found; + })) return true; + + GroovyLog.msg("Error removing Tinkers Construct Entity Melting recipe") + .add("could not find recipe with output {}", output) + .error() + .post(); + return false; + } + + @MethodDescription(priority = 2000, example = @Example(commented = true)) + public void removeAll() { + TinkerRegistryAccessor.getEntityMeltingRegistry().forEach((name, result) -> addBackup(new EntityMeltingRecipe(name, result))); + TinkerRegistryAccessor.getEntityMeltingRegistry().clear(); + } + + @MethodDescription(type = MethodDescription.Type.QUERY) + public SimpleObjectStream streamRecipes() { + return new SimpleObjectStream<>(getAllRecipes()).setRemover(this::remove); + } + + public class RecipeBuilder implements IRecipeBuilder { + + @Property(comp = @Comp(not = "null")) + private FluidStack output; + @Property(comp = @Comp(not = "null")) + private ResourceLocation input; + + @RecipeBuilderMethodDescription(field = "output") + public RecipeBuilder fluidOutput(FluidStack stack) { + this.output = stack; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(ResourceLocation name) { + this.input = name; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(String name) { + return input(new ResourceLocation(name)); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(String modid, String name) { + return input(new ResourceLocation(modid, name)); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(EntityEntry entity) { + return input(entity.getRegistryName()); + } + + 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); + msg.add(output == null || output.amount < 1, "Expected 1 output fluid but found none!"); + } + + @Override + public boolean validate() { + GroovyLog.Msg msg = GroovyLog.msg(this.getErrorMsg()).error(); + this.validate(msg); + return !msg.postIfNotEmpty(); + } + + @Override + @RecipeBuilderRegistrationMethod + public @Nullable EntityMeltingRecipe register() { + if (!validate()) return null; + EntityMeltingRecipe recipe = new EntityMeltingRecipe(input, output); + add(recipe); + return recipe; + } + } +} 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 8e35dcea0..124d5b403 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 @@ -22,6 +22,7 @@ public class SmelteryFuel extends VirtualizedRegistry { @GroovyBlacklist protected AbstractReloadableStorage createRecipeStorage() { return new AbstractReloadableStorage<>() { + @Override @GroovyBlacklist protected boolean compareRecipe(SmelteryFuelRecipe recipe, SmelteryFuelRecipe recipe2) { @@ -86,5 +87,4 @@ public void removeAll() { public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(getAllRecipes()).setRemover(this::remove); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/TinkersConstruct.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/TinkersConstruct.java index 9a1ca846e..a7900f445 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/TinkersConstruct.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/TinkersConstruct.java @@ -37,8 +37,9 @@ public void initialize(GroovyContainer container) { .register(); container.objectMapperBuilder("armorTrait", ITrait.class) .parser(IObjectParser.wrapStringGetter(s -> TinkerRegistryAccessor.getTraits().get(s + "_armor"))) - .completerOfNamed(TinkerRegistryAccessor.getTraits()::keySet, - v -> v.endsWith("_armor") ? v.substring(0, v.length() - 6) : null) // only suggest armor traits + .completerOfNamed( + TinkerRegistryAccessor.getTraits()::keySet, + v -> v.endsWith("_armor") ? v.substring(0, v.length() - 6) : null) // only suggest armor traits .docOfType("armor trait") .register(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterialIntegration.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterialIntegration.java index dfa952a2c..a303e0fbe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterialIntegration.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/material/GroovyMaterialIntegration.java @@ -11,8 +11,7 @@ public GroovyMaterialIntegration(Material material) { } @Override - public void preInit() { - } + public void preInit() {} @Override public void integrate() { 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 f146c978a..a9c82a9dd 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 @@ -23,8 +23,9 @@ public class MeltingRecipeBuilder extends AbstractRecipeBuilder { private final String recipeName; public static RecipeMatch recipeMatchFromIngredient(IIngredient ingredient, int amount) { - return (ingredient instanceof OreDictIngredient) ? RecipeMatch.of(((OreDictIngredient) ingredient).getOreDict(), amount) - : RecipeMatch.of(ingredient.getMatchingStacks()[0], amount); + return (ingredient instanceof OreDictIngredient) + ? RecipeMatch.of(((OreDictIngredient) ingredient).getOreDict(), amount) + : RecipeMatch.of(ingredient.getMatchingStacks()[0], amount); } public static RecipeMatch recipeMatchFromIngredient(IIngredient ingredient) { 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 d9df5a2a7..2b5603e5b 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 @@ -30,8 +30,9 @@ public RecipeBuilder recipeBuilder() { @Override public void onReload() { restoreFromBackup().forEach(drop -> ((CustomDropsRepositoryAccessor) Woot.customDropsRepository).getDrops().add(drop)); - removeScripted().forEach(drop -> ((CustomDropsRepositoryAccessor) Woot.customDropsRepository).getDrops() - .removeIf(d -> areCustomDropsEqual((CustomDropAccessor) d, (CustomDropAccessor) drop)) + removeScripted().forEach( + drop -> ((CustomDropsRepositoryAccessor) Woot.customDropsRepository).getDrops() + .removeIf(d -> areCustomDropsEqual((CustomDropAccessor) d, (CustomDropAccessor) drop)) ); } @@ -110,17 +111,11 @@ public SimpleObjectStream streamRecipes() { } private boolean areCustomDropsEqual(CustomDropAccessor target, CustomDropAccessor other) { - return target.getWootMobName().equals(other.getWootMobName()) && - ItemStack.areItemStacksEqual(target.getItemStack(), other.getItemStack()) && - target.getChanceMap().equals(other.getChanceMap()) && - target.getSizeMap().equals(other.getSizeMap()); + return target.getWootMobName().equals(other.getWootMobName()) && ItemStack.areItemStacksEqual(target.getItemStack(), other.getItemStack()) && target.getChanceMap().equals(other.getChanceMap()) && target.getSizeMap().equals(other.getSizeMap()); } private boolean areCustomDropsEqual(CustomDropAccessor target, WootMobName wootMobName, ItemStack itemStack, List chances, List sizes) { - return target.getWootMobName().equals(wootMobName) && - ItemStack.areItemStacksEqual(target.getItemStack(), itemStack) && - target.getChanceMap().values().containsAll(chances) && - target.getSizeMap().values().containsAll(sizes); + return target.getWootMobName().equals(wootMobName) && ItemStack.areItemStacksEqual(target.getItemStack(), itemStack) && target.getChanceMap().values().containsAll(chances) && target.getSizeMap().values().containsAll(sizes); } @Property(property = "output", comp = @Comp(eq = 1)) @@ -224,5 +219,4 @@ public void validate(GroovyLog.Msg msg) { return null; } } - } 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 8f336e0e5..cf0da3fe4 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 @@ -22,7 +22,7 @@ public void onReload() { restoreFromBackup().forEach(pair -> ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMobMap().put(pair.getKey(), pair.getValue())); removeScripted().forEach(pair -> { if (pair.getKey().contains(":")) ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMobMap().remove(pair.getKey()); - else ((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMap().put(EnumConfigKey.get(pair.getKey()), pair.getValue()); + else((WootConfigurationManagerAccessor) Woot.wootConfiguration).getIntegerMap().put(EnumConfigKey.get(pair.getKey()), pair.getValue()); }); } @@ -84,7 +84,9 @@ 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() + 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())); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Policy.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Policy.java index dcc09f728..ef2862585 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Policy.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Policy.java @@ -196,5 +196,4 @@ public enum PolicyType { ENTITY_WHITELIST,//getExternalEntityWhitelist GENERATE_ONLY_LIST//getExternalGenerateOnlyList } - } 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 6c7f9eccb..45be6f2be 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 @@ -165,8 +165,8 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; SpawnRecipe recipe = defaultSpawnRecipe - ? ((SpawnRecipeRepositoryAccessor) Woot.spawnRecipeRepository).getDefaultSpawnRecipe() - : new SpawnRecipe(); + ? ((SpawnRecipeRepositoryAccessor) Woot.spawnRecipeRepository).getDefaultSpawnRecipe() + : new SpawnRecipe(); for (IIngredient item : input) { recipe.addIngredient(item.getMatchingStacks()[0]); } @@ -179,5 +179,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } 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 ca29b1646..fe8791611 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 @@ -136,5 +136,4 @@ public void validate(GroovyLog.Msg msg) { return recipe; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Woot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Woot.java index af8c76a9b..7b590cace 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Woot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/Woot.java @@ -9,5 +9,4 @@ public class Woot extends GroovyPropertyContainer { public final Spawning spawning = new Spawning(); public final Policy policy = new Policy(); public final MobConfig mobConfig = new MobConfig(); - } 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 7f54438ff..3508e9d1c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipe.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.compat.vanilla; + import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.core.mixin.InventoryCraftingAccess; import com.cleanroommc.groovyscript.core.mixin.SlotCraftingAccess; @@ -21,8 +22,6 @@ import java.util.ArrayList; import java.util.List; -import static java.util.stream.Collectors.toCollection; - public abstract class CraftingRecipe extends IForgeRegistryEntry.Impl implements IRecipe, ICraftingRecipe { protected final ItemStack output; @@ -123,6 +122,7 @@ public boolean matches(@NotNull InventoryCrafting inv, @NotNull World worldIn) { public static class MatchList extends ArrayList { public static final MatchList EMPTY = new MatchList() { + @Override public boolean add(SlotMatchResult slotMatchResult) { throw new UnsupportedOperationException(); 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 b97fbe3fb..2f2b40cda 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/CraftingRecipeBuilder.java @@ -27,7 +27,8 @@ public String getRecipeNamePrefix() { @RecipeBuilderRegistrationMethod public IRecipe register() { validateName(); - GroovyLog.Msg msg = GroovyLog.msg("Error adding Minecraft Shaped Crafting recipe '{}'", this.name).error() + GroovyLog.Msg msg = GroovyLog.msg("Error adding Minecraft Shaped Crafting recipe '{}'", this.name) + .error() .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!") .add(IngredientHelper.isEmpty(this.output), () -> "Output must not be empty"); 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 9d97b7365..31c1f7a8a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/FurnaceRecipeManager.java @@ -12,6 +12,7 @@ public class FurnaceRecipeManager { public static final ObjectOpenCustomHashSet inputMap = new ObjectOpenCustomHashSet<>(new Hash.Strategy<>() { + @Override public int hashCode(ItemStack o) { return Objects.hash(o.getItem(), o.getMetadata()); 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 b6f2d8736..93df6018b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/ItemStackMixinExpansion.java @@ -67,8 +67,7 @@ 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) { @@ -143,7 +142,9 @@ default Ingredient toMcIngredient() { @Override default ItemStack[] getMatchingStacks() { - return new ItemStack[]{IngredientHelper.toItemStack(exactCopy())}; + return new ItemStack[]{ + IngredientHelper.toItemStack(exactCopy()) + }; } @Override 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 e2e01faf4..4b7d89f60 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java @@ -49,14 +49,16 @@ public void addStartingItem(ItemStack item) { public void addStartingItem(ItemStack item, int slot) { if (slot > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") - .warn().post(); + .warn() + .post(); } if (slot <= -1) { givenItemsAnySlot.add(item == null ? ItemStack.EMPTY : item); } else { if (givenItemsSlots.get(slot) != null) { GroovyLog.msg("Warning: slot {} has already been occupied by another item.", slot) - .error().post(); + .error() + .post(); return; } givenItemsSlots.put(slot, item == null ? ItemStack.EMPTY : item); @@ -66,7 +68,8 @@ public void addStartingItem(ItemStack item, int slot) { public void setStartingItems(boolean isSlotSpecific, ItemStack... items) { if (items.length > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") - .warn().post(); + .warn() + .post(); } if (isSlotSpecific) { givenItemsSlots.clear(); @@ -82,7 +85,8 @@ public void setStartingItems(boolean isSlotSpecific, ItemStack... items) { public void setStartingItems(boolean isSlotSpecific, List items) { if (items.size() > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") - .warn().post(); + .warn() + .post(); } if (isSlotSpecific) { givenItemsSlots.clear(); @@ -104,7 +108,5 @@ public void onReload() { @Override @GroovyBlacklist - public void afterScriptLoad() { - } - + public void afterScriptLoad() {} } 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 b05181932..1b02ce734 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java @@ -96,5 +96,4 @@ public String getName() { return name; } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/GenericInfoParser.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/GenericInfoParser.java index fc4a74eb7..73d050566 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/GenericInfoParser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/GenericInfoParser.java @@ -212,5 +212,4 @@ public void parse(InfoParserPackage info, boolean enabled) { if (blocked(info.getArgs())) return; if (enabled || allowed(info.getArgs())) parse(info); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBiome.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBiome.java index 00236c284..8f42297e1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBiome.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBiome.java @@ -29,5 +29,4 @@ public void parse(InfoParserPackage info) { if (info.getPos() == null || info.getEntity() == null) return; instance.add(info.getMessages(), info.getEntity().getEntityWorld().getBiome(info.getPos()), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlock.java index e937a3c86..4882a3063 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlock.java @@ -30,5 +30,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), info.getBlock(), info.isPrettyNbt()); InfoParserTranslationKey.instance.add(info.getMessages(), info.getBlock().getTranslationKey(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlockState.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlockState.java index ccc5709cb..0949b09fc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlockState.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserBlockState.java @@ -29,5 +29,4 @@ public void parse(InfoParserPackage info) { if (info.getBlockState() == null) return; instance.add(info.getMessages(), info.getBlockState(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserCreativeTab.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserCreativeTab.java index d81fbd2c9..74adaf963 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserCreativeTab.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserCreativeTab.java @@ -31,7 +31,5 @@ public void parse(InfoParserPackage info) { if (tab != null) { instance.add(info.getMessages(), tab, info.isPrettyNbt()); } - } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserDimension.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserDimension.java index d78a9c89e..95f9692e2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserDimension.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserDimension.java @@ -29,5 +29,4 @@ public void parse(InfoParserPackage info) { if (info.getEntity() == null) return; instance.add(info.getMessages(), info.getEntity().world.provider.getDimensionType(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEnchantment.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEnchantment.java index ae33fafb7..447f500d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEnchantment.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEnchantment.java @@ -34,5 +34,4 @@ public void parse(InfoParserPackage info) { List list = new ArrayList<>(EnchantmentHelper.getEnchantments(info.getStack()).keySet()); instance.add(info.getMessages(), list, info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEntity.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEntity.java index 2941c6389..8b999a365 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEntity.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserEntity.java @@ -42,5 +42,4 @@ public void parse(InfoParserPackage info) { InfoParserTranslationKey.instance.add(info.getMessages(), rl.toString(), info.isPrettyNbt()); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserFluid.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserFluid.java index 49992328c..384b84387 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserFluid.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserFluid.java @@ -63,5 +63,4 @@ public void parse(InfoParserPackage info) { } } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserItem.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserItem.java index 7e31aba8a..f712c6af0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserItem.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserItem.java @@ -52,5 +52,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), info.getStack(), info.isPrettyNbt()); InfoParserTranslationKey.instance.add(info.getMessages(), info.getStack().getTranslationKey(), info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserNBT.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserNBT.java index b742d7b7c..84076f9a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserNBT.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserNBT.java @@ -81,5 +81,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), info.getStack().serializeNBT(), info.isPrettyNbt()); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserPotionEffect.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserPotionEffect.java index 6e96258db..33170f276 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserPotionEffect.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserPotionEffect.java @@ -41,5 +41,4 @@ public void parse(InfoParserPackage info) { if (list.isEmpty()) return; instance.add(info.getMessages(), list, info.isPrettyNbt()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserTranslationKey.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserTranslationKey.java index a611bb5e5..1a7298e34 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserTranslationKey.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserTranslationKey.java @@ -27,5 +27,4 @@ public String text(@NotNull String entry, boolean colored, boolean prettyNbt) { public void parse(InfoParserPackage info) { // translation isn't used via the registry (what parse does) but is instead directly called by individual InfoParsers } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerCareer.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerCareer.java index 943cad9a4..d609ed590 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerCareer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerCareer.java @@ -39,5 +39,4 @@ public void parse(InfoParserPackage info) { InfoParserTranslationKey.instance.add(info.getMessages(), "entity.Villager." + career.getName(), info.isPrettyNbt()); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerProfession.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerProfession.java index fbb396821..325bc1d9e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerProfession.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/InfoParserVillagerProfession.java @@ -37,5 +37,4 @@ public void parse(InfoParserPackage info) { instance.add(info.getMessages(), villager.getProfessionForge(), info.isPrettyNbt()); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/StandardInfoParserRegistry.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/StandardInfoParserRegistry.java index f6920d943..f10f34f64 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/StandardInfoParserRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/command/infoparser/StandardInfoParserRegistry.java @@ -20,5 +20,4 @@ public static void init() { InfoParserRegistry.addInfoParser(InfoParserEnchantment.instance); InfoParserRegistry.addInfoParser(InfoParserPotionEffect.instance); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptTransformer.java b/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptTransformer.java index a601a6d93..a47c3bd61 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptTransformer.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/GroovyScriptTransformer.java @@ -102,9 +102,12 @@ private byte[] transformSideOnly(String className, byte[] bytes) { private static class LambdaGatherer extends MethodVisitor { - private static final Handle META_FACTORY = new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", - "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;", - false); + private static final Handle META_FACTORY = new Handle( + Opcodes.H_INVOKESTATIC, + "java/lang/invoke/LambdaMetafactory", + "metafactory", + "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;", + false); private final List dynamicLambdaHandles = new ArrayList(); public LambdaGatherer() { diff --git a/src/main/java/com/cleanroommc/groovyscript/core/SideOnlyConfig.java b/src/main/java/com/cleanroommc/groovyscript/core/SideOnlyConfig.java index 91604826f..94335efda 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/SideOnlyConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/SideOnlyConfig.java @@ -22,7 +22,9 @@ public class SideOnlyConfig { private static final MethodSet CLASS_MARKER = new MethodSet(true); private static final Function DEFAULT_METHOD_SET = s -> new MethodSet(false); - private static final String[] commonKeys = {"common", "both", "all"}; + private static final String[] commonKeys = { + "common", "both", "all" + }; private static final Map clientRemovals = new Object2ObjectOpenHashMap<>(); private static final Map serverRemovals = new Object2ObjectOpenHashMap<>(); 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 8ca59881f..69c94222b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EntityItemMixin.java @@ -28,10 +28,7 @@ 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, pos, blockState) && - thisEntity.isDead) { + if (fluid != null && FluidRecipe.isSourceBlock(blockState) && FluidRecipe.findAndRunRecipe(fluid, thisEntity.world, pos, 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 8c3eff0fa..9b724fc21 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/EventBusMixin.java @@ -35,5 +35,4 @@ public void register(Class eventClass, EventPriority priority, IEventListener e.printStackTrace(); } } - } 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 72ee91e22..3db4997d9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ForgeRegistryMixin.java @@ -64,15 +64,20 @@ public abstract class ForgeRegistryMixin> imple @Shadow @Final private RegistryManager stage; - @Unique private Set> groovyScript$backups; - @Unique private Set groovyScript$scripted; - @Unique private Supplier groovyScript$dummySupplier; + @Unique + private Set> groovyScript$backups; + @Unique + private Set groovyScript$scripted; + @Unique + private Supplier groovyScript$dummySupplier; @Unique @Final private final Set groovyScript$dummies = new ObjectOpenHashSet<>(); - @Unique private IReloadableForgeRegistry groovyScript$vanilla; - @Unique private IReloadableForgeRegistry groovyScript$frozen; + @Unique + private IReloadableForgeRegistry groovyScript$vanilla; + @Unique + private IReloadableForgeRegistry groovyScript$frozen; @Override public V groovyScript$registerEntry(V registryEntry) { @@ -152,8 +157,15 @@ public abstract class ForgeRegistryMixin> imple @Unique public V groovyScript$putDummy(V entry, ResourceLocation rl, Integer id, Object owner, DummyContext context) { if (entry == null || rl == null || id == null) { - GroovyLog.get().errorMC("Error putting dummy in forge registry for {} during {} at stage {}. Are null: entry-{}, name-{}, id-{}", - superType.getSimpleName(), context.name().toLowerCase(Locale.ROOT), stage.getName(), entry == null, rl == null, id == null); + GroovyLog.get() + .errorMC( + "Error putting dummy in forge registry for {} during {} at stage {}. Are null: entry-{}, name-{}, id-{}", + superType.getSimpleName(), + context.name().toLowerCase(Locale.ROOT), + stage.getName(), + entry == null, + rl == null, + id == null); return null; } V dummy = groovyScript$getDummy(rl); @@ -180,8 +192,12 @@ public abstract class ForgeRegistryMixin> imple if (dummy != null) { Integer id = this.ids.inverse().remove(dummy); if (id == null) { - GroovyLog.get().errorMC("No id found while removing a dummy with name '{}' from {} registry at stage {}.", - rl, superType.getSimpleName(), stage.getName()); + GroovyLog.get() + .errorMC( + "No id found while removing a dummy with name '{}' from {} registry at stage {}.", + rl, + superType.getSimpleName(), + stage.getName()); } else { this.availabilityMap.clear(id); id0 = id; @@ -227,4 +243,3 @@ public abstract class ForgeRegistryMixin> imple } } } - diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemMixin.java index b6af180a1..b6b296483 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/ItemMixin.java @@ -17,5 +17,4 @@ public class ItemMixin { private void prioritzeGSRarities(ItemStack stack, CallbackInfoReturnable cir) { cir.setReturnValue(VanillaModule.rarity.check(stack)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/OreIngredientMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/OreIngredientMixin.java index b1723d3dc..b9b5e9095 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/OreIngredientMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/OreIngredientMixin.java @@ -22,5 +22,4 @@ private void init(String ore, CallbackInfo ci) { public String getOreDict() { return groovyScript$oreDict; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/TileEntityPistonMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/TileEntityPistonMixin.java index a616a4c60..600ef44d5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/TileEntityPistonMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/TileEntityPistonMixin.java @@ -32,17 +32,16 @@ public abstract class TileEntityPistonMixin { private boolean shouldHeadBeRendered; @Inject(method = "moveCollidedEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;isStickyBlock(Lnet/minecraft/block/state/IBlockState;)Z", shift = At.Shift.AFTER), remap = false) - private void moveCollidedEntitiesPre(float f, CallbackInfo ci, @Local(ordinal = 0) EnumFacing facing, + private void moveCollidedEntitiesPre(float f, + CallbackInfo ci, + @Local(ordinal = 0) EnumFacing facing, @Local(ordinal = 1) List list1, @Share("tryRecipesUntil") LocalIntRef tryRecipesUntil, @Share("pushingAgainst") LocalRef pushingAgainst, @Share("checkRecipes") LocalBooleanRef checkRecipes) { TileEntityPiston piston = (TileEntityPiston) (Object) this; tryRecipesUntil.set(list1.size()); - boolean b = !piston.getWorld().isRemote && - this.extending && - this.shouldHeadBeRendered && - f >= 1.0f; + boolean b = !piston.getWorld().isRemote && this.extending && this.shouldHeadBeRendered && f >= 1.0f; if (b) { pushingAgainst.set(piston.getWorld().getBlockState(piston.getPos().offset(facing))); checkRecipes.set(!(pushingAgainst.get() instanceof BlockPistonMoving) && pushingAgainst.get().getMaterial() != Material.AIR); @@ -52,8 +51,12 @@ private void moveCollidedEntitiesPre(float f, CallbackInfo ci, @Local(ordinal = } @Inject(method = "moveCollidedEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPushReaction()Lnet/minecraft/block/material/EnumPushReaction;", shift = At.Shift.AFTER)) - private void moveCollidedEntitiesPost(float p_184322_1_, CallbackInfo ci, @Local int index, @Local(ordinal = 1) List list1, - @Share("tryRecipesUntil") LocalIntRef tryRecipesUntil, @Share("pushingAgainst") LocalRef pushingAgainst, + private void moveCollidedEntitiesPost(float p_184322_1_, + CallbackInfo ci, + @Local int index, + @Local(ordinal = 1) List list1, + @Share("tryRecipesUntil") LocalIntRef tryRecipesUntil, + @Share("pushingAgainst") LocalRef pushingAgainst, @Share("checkRecipes") LocalBooleanRef checkRecipes) { Entity entity = list1.get(index); if (entity.getPushReaction() == EnumPushReaction.IGNORE) return; diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/VillagerProfessionAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/VillagerProfessionAccessor.java index c19ce7bf4..d9a28e13c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/VillagerProfessionAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/VillagerProfessionAccessor.java @@ -11,5 +11,4 @@ public interface VillagerProfessionAccessor { @Accessor List getCareers(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/advancedmortars/RegistryRecipeMortarAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/advancedmortars/RegistryRecipeMortarAccessor.java index 5d0718e4e..cc1bef5f9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/advancedmortars/RegistryRecipeMortarAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/advancedmortars/RegistryRecipeMortarAccessor.java @@ -14,5 +14,4 @@ public interface RegistryRecipeMortarAccessor { @Accessor EnumMap> getRecipeMap(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MatterCannonAmmoRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MatterCannonAmmoRegistryAccessor.java index 6a8ebb6fb..1fca54377 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MatterCannonAmmoRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MatterCannonAmmoRegistryAccessor.java @@ -12,5 +12,4 @@ public interface MatterCannonAmmoRegistryAccessor { @Accessor("DamageModifiers") HashMap getDamageModifiers(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MovableTileRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MovableTileRegistryAccessor.java index 6d0637d26..135828b2d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MovableTileRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/MovableTileRegistryAccessor.java @@ -17,5 +17,4 @@ public interface MovableTileRegistryAccessor { @Accessor("Valid") HashMap, IMovableHandler> getValid(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/P2PTunnelRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/P2PTunnelRegistryAccessor.java index e9c739644..05a8addd3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/P2PTunnelRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/appliedenergistics2/P2PTunnelRegistryAccessor.java @@ -20,5 +20,4 @@ public interface P2PTunnelRegistryAccessor { @Accessor Map, TunnelType> getCapTunnels(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationBaseAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationBaseAccessor.java index c7b19cf12..3ccf2c7d2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationBaseAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationBaseAccessor.java @@ -12,5 +12,4 @@ public interface ConstellationBaseAccessor { @Accessor List getSignatureItems(); - } 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 d5f2f7c48..f3336ba67 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 @@ -14,5 +14,4 @@ public interface ConstellationMapEffectRegistryAccessor { static Map getEffectRegistry() { return null; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationRegistryAccessor.java index 063b7c07c..525413ab0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ConstellationRegistryAccessor.java @@ -28,5 +28,4 @@ static List getWeakConstellations() { static List getMinorConstellations() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/FluidRarityRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/FluidRarityRegistryAccessor.java index 6005e03b8..484d60eec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/FluidRarityRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/FluidRarityRegistryAccessor.java @@ -11,5 +11,4 @@ public interface FluidRarityRegistryAccessor { @Accessor List getRarityList(); - } 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 2c34795c3..0b184109c 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 @@ -13,5 +13,4 @@ public interface LightOreTransmutationsAccessor { 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 04a694511..2bd7827cd 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 @@ -16,5 +16,4 @@ static List getRegisteredInteractions() { @Accessor("action") LiquidInteraction.FluidInteractionAction getFluidInteractionAction(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/OreTypesAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/OreTypesAccessor.java index 9727573af..43e8fcf23 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/OreTypesAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/OreTypesAccessor.java @@ -22,5 +22,4 @@ public interface OreTypesAccessor { @Invoker("appendOreEntry") void add(OreEntry entry); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerAccessor.java index 248989895..912e165d3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerAccessor.java @@ -11,13 +11,11 @@ public interface PerkLevelManagerAccessor { @Accessor("LEVEL_CAP") - static void setLevelCap(int cap) { - } + static void setLevelCap(int cap) {} @Accessor("totalExpLevelRequired") Map getLevelMap(); @Invoker("ensureLevels") void generateLevelMap(); - -} \ No newline at end of file +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerMixin.java index 307ad01be..6fe4aa2dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkLevelManagerMixin.java @@ -34,5 +34,4 @@ public void ensureLevels(CallbackInfo ci) { } ci.cancel(); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkTreeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkTreeAccessor.java index df2bd4400..f4da97544 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkTreeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/PerkTreeAccessor.java @@ -24,5 +24,4 @@ public interface PerkTreeAccessor { @Accessor List> getConnections(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ResearchNodeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ResearchNodeAccessor.java index af029138d..f039f4a15 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ResearchNodeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/ResearchNodeAccessor.java @@ -12,5 +12,4 @@ public interface ResearchNodeAccessor { @Accessor("renderPosZ") void setZ(int z); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/TileCelestialCrystalsMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/TileCelestialCrystalsMixin.java index 661cf535f..e472f09e9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/TileCelestialCrystalsMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/TileCelestialCrystalsMixin.java @@ -18,5 +18,4 @@ public IBlockState replaceIronOreDowngrade(Block instance, Operation getTraitStackMap(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/WellLiquefactionAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/WellLiquefactionAccessor.java index 214e6ff6f..903b23841 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/WellLiquefactionAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/astralsorcery/WellLiquefactionAccessor.java @@ -14,5 +14,4 @@ public interface WellLiquefactionAccessor { static Map getRegisteredLiquefactions() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/BWMHeatRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/BWMHeatRegistryAccessor.java index 5db2ceede..4f2c8528e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/BWMHeatRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/BWMHeatRegistryAccessor.java @@ -13,5 +13,4 @@ public interface BWMHeatRegistryAccessor { static List getHEAT_SOURCES() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/HopperFiltersAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/HopperFiltersAccessor.java index 977686b8b..0c621bdfc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/HopperFiltersAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/betterwithmods/HopperFiltersAccessor.java @@ -12,5 +12,4 @@ public interface HopperFiltersAccessor { @Accessor Map getFILTERS(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/bloodmagic/BloodMagicRecipeRegistrarAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/bloodmagic/BloodMagicRecipeRegistrarAccessor.java index 4176e39ca..6af9310de 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/bloodmagic/BloodMagicRecipeRegistrarAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/bloodmagic/BloodMagicRecipeRegistrarAccessor.java @@ -24,5 +24,4 @@ public interface BloodMagicRecipeRegistrarAccessor { @Accessor Set getSacrificeCraftRecipes(); - } 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 541ef7e61..c8a6e9c52 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 @@ -68,12 +68,13 @@ public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) { } else { this.oreDictRecipe = recipe instanceof ShapedOreRecipe; int width = oreDictRecipe - ? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "width") - : recipe instanceof ShapedCraftingRecipe ? ((ShapedCraftingRecipe) recipe).getRecipeWidth() : ((ShapedRecipes) recipe).getWidth(); + ? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "width") + : recipe instanceof ShapedCraftingRecipe ? ((ShapedCraftingRecipe) recipe).getRecipeWidth() + : ((ShapedRecipes) recipe).getWidth(); int height = oreDictRecipe - ? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "height") - : recipe instanceof ShapedCraftingRecipe ? ((ShapedCraftingRecipe) recipe).getRecipeHeight() - : ((ShapedRecipes) recipe).getHeight(); + ? ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, (ShapedOreRecipe) recipe, "height") + : recipe instanceof ShapedCraftingRecipe ? ((ShapedCraftingRecipe) recipe).getRecipeHeight() + : ((ShapedRecipes) recipe).getHeight(); for (index = 0; index < height; ++index) { for (x = 0; x < width; ++x) { diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/DefinedRecipeHelperMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/DefinedRecipeHelperMixin.java index 48cc320d9..19a6f92b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/DefinedRecipeHelperMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/DefinedRecipeHelperMixin.java @@ -16,5 +16,4 @@ public abstract class DefinedRecipeHelperMixin extends RecipeHelperV2Mixin { public void buildRecipe(List recipeInputs, List recipeOutputs, List additionals, boolean shapeless, CallbackInfoReturnable cir) { cir.setReturnValue(new CalculatorRecipe(recipeInputs, recipeOutputs, ResearchRecipeType.NONE, shapeless)); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/RecipeHelperV2Mixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/RecipeHelperV2Mixin.java index 494d5afd1..7709e0cac 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/RecipeHelperV2Mixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/calculator/RecipeHelperV2Mixin.java @@ -14,7 +14,5 @@ public class RecipeHelperV2Mixin { @Inject(method = "buildRecipe", at = @At("RETURN"), cancellable = true) - public void buildRecipe(List recipeInputs, List recipeOutputs, List additionals, boolean shapeless, CallbackInfoReturnable cir) { - } - + public void buildRecipe(List recipeInputs, List recipeOutputs, List additionals, boolean shapeless, CallbackInfoReturnable cir) {} } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/InvisECoreBlockMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/InvisECoreBlockMixin.java index 17dc1bc1a..a4e8fe924 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/InvisECoreBlockMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/draconicevolution/InvisECoreBlockMixin.java @@ -18,8 +18,11 @@ @Mixin(value = InvisECoreBlock.class, remap = false) public class InvisECoreBlockMixin { - @Inject(method = "onBlockHarvested(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/player/EntityPlayer;)V", - at = @At("HEAD"), cancellable = true, remap = true) + @Inject( + method = "onBlockHarvested(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/player/EntityPlayer;)V", + at = @At("HEAD"), + cancellable = true, + remap = true) public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player, CallbackInfo ci) { if (GroovyScriptConfig.compat.draconicEvolutionEnergyCore) { InvisECoreBlockLogic.onBlockHarvested(world, pos, player); 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 5ec33f542..cffbef41d 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 @@ -37,9 +37,7 @@ public void validateStructure(CallbackInfoReturnable cir) { var helper = ((BlockStateEnergyCoreStructure) tile.coreStructure).getHelper(); if (!(tile.coreValid.value = tile.coreStructure.checkTier(tile.tier.value))) { BlockPos pos = helper.invalidBlock; - tile.invalidMessage.value = "Error At: x:" + pos.getX() + ", y:" + pos.getY() + ", z:" + pos.getZ() + - " Expected: " + helper.expectedBlockState.getBlock().getRegistryName() + ":" + - helper.expectedBlockState.getBlock().getMetaFromState(helper.expectedBlockState); + tile.invalidMessage.value = "Error At: x:" + pos.getX() + ", y:" + pos.getY() + ", z:" + pos.getZ() + " Expected: " + helper.expectedBlockState.getBlock().getRegistryName() + ":" + helper.expectedBlockState.getBlock().getMetaFromState(helper.expectedBlockState); valid = false; } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerAccessor.java index fc189111f..404564006 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerAccessor.java @@ -21,5 +21,4 @@ static void invokeAddRecipeToLookup(@NotNull TriItemLookup loo @Invoker void invokeAddJEIIntegration(@NotNull IManyToOneRecipe recipe); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerMixin.java index 56d51cbb0..89be1af12 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/AlloyRecipeManagerMixin.java @@ -18,5 +18,4 @@ private void afterAddRecipe(IManyToOneRecipe recipe, CallbackInfo ci) { ModSupport.ENDER_IO.get().alloySmelter.addScripted(recipe); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/FluidFuelRegisterAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/FluidFuelRegisterAccessor.java index 71f9ec662..f91faa32f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/FluidFuelRegisterAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/FluidFuelRegisterAccessor.java @@ -16,5 +16,4 @@ public interface FluidFuelRegisterAccessor { @Accessor Map getFuels(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeLeafNodeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeLeafNodeAccessor.java index 82f2b6270..93d6f6165 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeLeafNodeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeLeafNodeAccessor.java @@ -13,5 +13,4 @@ public interface ItemRecipeLeafNodeAccessor extends IRecipeNode> getMap(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeNodeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeNodeAccessor.java index 05415a6d1..8fc88c13e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeNodeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/ItemRecipeNodeAccessor.java @@ -13,5 +13,4 @@ public interface ItemRecipeNodeAccessor> { @Accessor Int2ObjectOpenHashMap, CHL>> getMap(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/TriItemLookupAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/TriItemLookupAccessor.java index 8252fbb97..53b0f6306 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/TriItemLookupAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/enderio/TriItemLookupAccessor.java @@ -11,5 +11,4 @@ public interface TriItemLookupAccessor { @Accessor ItemRecipeNode>> getRoot(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/OreSmeltingRecipeMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/OreSmeltingRecipeMixin.java index fa96ef1f0..8df042263 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/OreSmeltingRecipeMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/OreSmeltingRecipeMixin.java @@ -1,29 +1,28 @@ -package com.cleanroommc.groovyscript.core.mixin.essentialcraft; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import essentialcraft.api.OreSmeltingRecipe; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -@Mixin(value = OreSmeltingRecipe.class, remap = false) -public abstract class OreSmeltingRecipeMixin { - - /** - * @reason This mixin fixes a client crash when reloading recipes for Magmatic Smeltery, - * which happens when a deleted Magmatic Ore item is being rendered and the mod cannot determine the Alloy's overlay color. - */ - - @WrapOperation(method = "getColorFromItemStack", at = @At(value = "FIELD", target = "Lessentialcraft/api/OreSmeltingRecipe;color:I")) - private static int getColorFromItemStack(OreSmeltingRecipe recipe, Operation original) { - if (recipe == null) return 16777215; - return original.call(recipe); - } - - @WrapOperation(method = "getLocalizedOreName", at = @At(value = "FIELD", target = "Lessentialcraft/api/OreSmeltingRecipe;oreName:Ljava/lang/String;")) - private static String getLocalizedOreName(OreSmeltingRecipe recipe, Operation original) { - if (recipe == null) return ""; - return original.call(recipe); - } - -} +package com.cleanroommc.groovyscript.core.mixin.essentialcraft; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import essentialcraft.api.OreSmeltingRecipe; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(value = OreSmeltingRecipe.class, remap = false) +public abstract class OreSmeltingRecipeMixin { + + /** + * @reason This mixin fixes a client crash when reloading recipes for Magmatic Smeltery, + * which happens when a deleted Magmatic Ore item is being rendered and the mod cannot determine the Alloy's overlay color. + */ + + @WrapOperation(method = "getColorFromItemStack", at = @At(value = "FIELD", target = "Lessentialcraft/api/OreSmeltingRecipe;color:I")) + private static int getColorFromItemStack(OreSmeltingRecipe recipe, Operation original) { + if (recipe == null) return 16777215; + return original.call(recipe); + } + + @WrapOperation(method = "getLocalizedOreName", at = @At(value = "FIELD", target = "Lessentialcraft/api/OreSmeltingRecipe;oreName:Ljava/lang/String;")) + private static String getLocalizedOreName(OreSmeltingRecipe recipe, Operation original) { + if (recipe == null) return ""; + return original.call(recipe); + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileFurnaceMagicMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileFurnaceMagicMixin.java index 0d5f2986f..3dbd3cd8a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileFurnaceMagicMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileFurnaceMagicMixin.java @@ -1,33 +1,33 @@ -package com.cleanroommc.groovyscript.core.mixin.essentialcraft; - -import essentialcraft.api.OreSmeltingRecipe; -import essentialcraft.common.item.ItemsCore; -import essentialcraft.common.tile.TileFurnaceMagic; -import essentialcraft.common.tile.TileMRUGeneric; -import net.minecraft.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = TileFurnaceMagic.class, remap = false) -public abstract class TileFurnaceMagicMixin extends TileMRUGeneric { - - @Shadow - public int smeltingLevel; - - /** - * @reason This mixin fixes a server crash when an invalid Magmatic Ore is put into the Magmatic Furnace's input slot. - * Normally this causes an ArrayOutOfBoundsException when the recipe with index -1 (invalid input) is being read from the registry. - * The indices of its slots are as follows: Bound Gem (0), Ore/Magmatic Alloy input (1), Magmatic Alloy/Resource output (2). - */ - @Inject(method = "update", at = @At("HEAD"), cancellable = true) - public void onUpdate(CallbackInfo ci) { - ItemStack alloy = this.getStackInSlot(1); - if (alloy.getItem() == ItemsCore.magicalAlloy && OreSmeltingRecipe.getIndex(alloy) == -1) { - this.smeltingLevel = 0; - ci.cancel(); - } - } -} +package com.cleanroommc.groovyscript.core.mixin.essentialcraft; + +import essentialcraft.api.OreSmeltingRecipe; +import essentialcraft.common.item.ItemsCore; +import essentialcraft.common.tile.TileFurnaceMagic; +import essentialcraft.common.tile.TileMRUGeneric; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = TileFurnaceMagic.class, remap = false) +public abstract class TileFurnaceMagicMixin extends TileMRUGeneric { + + @Shadow + public int smeltingLevel; + + /** + * @reason This mixin fixes a server crash when an invalid Magmatic Ore is put into the Magmatic Furnace's input slot. + * Normally this causes an ArrayOutOfBoundsException when the recipe with index -1 (invalid input) is being read from the registry. + * The indices of its slots are as follows: Bound Gem (0), Ore/Magmatic Alloy input (1), Magmatic Alloy/Resource output (2). + */ + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void onUpdate(CallbackInfo ci) { + ItemStack alloy = this.getStackInSlot(1); + if (alloy.getItem() == ItemsCore.magicalAlloy && OreSmeltingRecipe.getIndex(alloy) == -1) { + this.smeltingLevel = 0; + ci.cancel(); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileMagmaticSmelterMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileMagmaticSmelterMixin.java index 05cc519b2..f1bff45d6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileMagmaticSmelterMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/essentialcraft/TileMagmaticSmelterMixin.java @@ -1,35 +1,35 @@ -package com.cleanroommc.groovyscript.core.mixin.essentialcraft; - -import essentialcraft.api.OreSmeltingRecipe; -import essentialcraft.common.item.ItemsCore; -import essentialcraft.common.tile.TileMRUGeneric; -import essentialcraft.common.tile.TileMagmaticSmelter; -import net.minecraft.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = TileMagmaticSmelter.class, remap = false) -public abstract class TileMagmaticSmelterMixin extends TileMRUGeneric { - - @Shadow - public int smeltingLevel; - - /** - * @reason This mixin fixes a server crash when an invalid Magmatic Ore is put into the Magmatic Smeltery's input slot. - * Normally this causes an ArrayOutOfBoundsException when the recipe with index -1 (invalid input) is being read from the registry. - * The indices of its slots are as follows: Bound Gem (0), Lava Bucket (1), Empty Bucket output (2), - * Ore input (3), Magmatic Alloy output (4), Magmatic Alloy input (5), Resource output (6), Magical Slag (7). - */ - @Inject(method = "update", at = @At("HEAD"), cancellable = true) - public void onUpdate(CallbackInfo ci) { - ItemStack ore = this.getStackInSlot(3); - ItemStack alloy = this.getStackInSlot(5); - if (ore.isEmpty() && alloy.getItem() == ItemsCore.magicalAlloy && OreSmeltingRecipe.getIndex(alloy) == -1) { - this.smeltingLevel = 0; - ci.cancel(); - } - } -} +package com.cleanroommc.groovyscript.core.mixin.essentialcraft; + +import essentialcraft.api.OreSmeltingRecipe; +import essentialcraft.common.item.ItemsCore; +import essentialcraft.common.tile.TileMRUGeneric; +import essentialcraft.common.tile.TileMagmaticSmelter; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = TileMagmaticSmelter.class, remap = false) +public abstract class TileMagmaticSmelterMixin extends TileMRUGeneric { + + @Shadow + public int smeltingLevel; + + /** + * @reason This mixin fixes a server crash when an invalid Magmatic Ore is put into the Magmatic Smeltery's input slot. + * Normally this causes an ArrayOutOfBoundsException when the recipe with index -1 (invalid input) is being read from the registry. + * The indices of its slots are as follows: Bound Gem (0), Lava Bucket (1), Empty Bucket output (2), + * Ore input (3), Magmatic Alloy output (4), Magmatic Alloy input (5), Resource output (6), Magical Slag (7). + */ + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void onUpdate(CallbackInfo ci) { + ItemStack ore = this.getStackInSlot(3); + ItemStack alloy = this.getStackInSlot(5); + if (ore.isEmpty() && alloy.getItem() == ItemsCore.magicalAlloy && OreSmeltingRecipe.getIndex(alloy) == -1) { + this.smeltingLevel = 0; + ci.cancel(); + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeAccessor.java index 83f95d03f..28aa96f1a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeAccessor.java @@ -26,5 +26,4 @@ public interface GeneratorTypeAccessor { @Mutable @Accessor void setCaps(TreeMap> caps); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeMixin.java index 95bfec445..0c11d039b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/GeneratorTypeMixin.java @@ -24,5 +24,4 @@ public void basePowerGen(CallbackInfoReturnable cir) { cir.setReturnValue(value); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/PassiveBlockGeneratorMillMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/PassiveBlockGeneratorMillMixin.java index 184219998..32360da42 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/PassiveBlockGeneratorMillMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/extrautils2/PassiveBlockGeneratorMillMixin.java @@ -38,5 +38,4 @@ public void getPowerLevel(TilePassiveGenerator generator, World world, CallbackI cir.setReturnValue(ClosureHelper.call(0.0f, value, generator, world)); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/CompUnitClassGenMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/CompUnitClassGenMixin.java index 783ead055..fd807c413 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/CompUnitClassGenMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/CompUnitClassGenMixin.java @@ -16,10 +16,12 @@ @Mixin(targets = "org/codehaus/groovy/control/CompilationUnit$3", remap = false) public class CompUnitClassGenMixin { - @Inject(method = "call", - at = @At(value = "INVOKE", - target = "Lorg/codehaus/groovy/ast/GroovyClassVisitor;visitClass(Lorg/codehaus/groovy/ast/ClassNode;)V", - ordinal = 4), + @Inject( + method = "call", + at = @At( + value = "INVOKE", + target = "Lorg/codehaus/groovy/ast/GroovyClassVisitor;visitClass(Lorg/codehaus/groovy/ast/ClassNode;)V", + ordinal = 4), locals = LocalCapture.CAPTURE_FAILEXCEPTION) public void call(SourceUnit source, GeneratorContext context, ClassNode classNode, CallbackInfo ci, GroovyClassVisitor visitor) { GroovyCodeFactory.remapOverrides(classNode); 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 15f631f84..3c0dc76ad 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 @@ -2,8 +2,8 @@ import com.cleanroommc.groovyscript.sandbox.mapper.GroovyDeobfMapper; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; -import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.*; +import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.stmt.ReturnStatement; import org.codehaus.groovy.vmplugin.v8.Java8; 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 452028609..13cfe07bd 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 @@ -5,8 +5,8 @@ import com.cleanroommc.groovyscript.sandbox.security.GroovySecurityManager; import groovy.lang.*; import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl; -import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -19,11 +19,18 @@ public abstract class MetaClassImplMixin { @Shadow - protected abstract Object doInvokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, - boolean isCallToSuper, boolean fromInsideClass); + protected abstract Object doInvokeMethod(Class sender, + Object object, + String methodName, + Object[] originalArguments, + boolean isCallToSuper, + boolean fromInsideClass); @Shadow - protected abstract Object invokeMissingMethod(Object instance, String methodName, Object[] arguments, RuntimeException original, + protected abstract Object invokeMissingMethod(Object instance, + String methodName, + Object[] arguments, + RuntimeException original, boolean isCallToSuper); @Shadow @@ -70,11 +77,17 @@ public void removeBlacklistedAdditional(Class theClass, MetaMethod[] add, Cal } } - @Inject(method = "invokeMethod(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;ZZ)Ljava/lang/Object;", + @Inject( + method = "invokeMethod(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;ZZ)Ljava/lang/Object;", at = @At("HEAD"), cancellable = true) - public void invokeMethod(Class sender, Object object, String methodName, Object[] arguments, boolean isCallToSuper, - boolean fromInsideClass, CallbackInfoReturnable cir) { + public void invokeMethod(Class sender, + Object object, + String methodName, + Object[] arguments, + boolean isCallToSuper, + boolean fromInsideClass, + CallbackInfoReturnable cir) { try { cir.setReturnValue(doInvokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass)); } catch (MissingMethodException mme) { @@ -94,7 +107,10 @@ public void invokeStaticMissingMethod(Class sender, String methodName, Object * @reason class scripts being unable to use bindings and this method calling closures improperly */ @Overwrite - private Object invokePropertyOrMissing(Object object, String methodName, Object[] originalArguments, boolean fromInsideClass, + private Object invokePropertyOrMissing(Object object, + String methodName, + Object[] originalArguments, + boolean fromInsideClass, boolean isCallToSuper) { MetaProperty metaProperty = getMetaProperty(methodName, false); @@ -109,7 +125,7 @@ private Object invokePropertyOrMissing(Object object, String methodName, Object[ value = GroovyScript.getSandbox().getBindings().get(methodName); } - if (value instanceof Closure closure) { + if (value instanceof Closureclosure) { return closure.call(originalArguments); } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/ModuleNodeMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/ModuleNodeMixin.java index f053d5485..3bd445c91 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/ModuleNodeMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/groovy/ModuleNodeMixin.java @@ -13,14 +13,15 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.io.File; @Mixin(value = ModuleNode.class, remap = false) public abstract class ModuleNodeMixin { - @Shadow private PackageNode packageNode; + @Shadow + private PackageNode packageNode; - @Shadow private transient SourceUnit context; + @Shadow + private transient SourceUnit context; @Inject(method = "(Lorg/codehaus/groovy/control/SourceUnit;)V", at = @At("TAIL")) public void init(SourceUnit context, CallbackInfo ci) { diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/inspirations/InspirationsRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/inspirations/InspirationsRegistryAccessor.java index eec974500..74182cb2a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/inspirations/InspirationsRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/inspirations/InspirationsRegistryAccessor.java @@ -34,6 +34,4 @@ static Set getAnvilBreaking() { static List getCauldronRecipes() { throw new UnsupportedOperationException(); } - } - diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/IngredientInfoRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/IngredientInfoRecipeAccessor.java index 0a7a3cb7b..28c44611d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/IngredientInfoRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/IngredientInfoRecipeAccessor.java @@ -15,5 +15,4 @@ public interface IngredientInfoRecipeAccessor { @Accessor IIngredientType getIngredientType(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/JeiStarterMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/JeiStarterMixin.java index d3033dff8..4e1a92084 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/JeiStarterMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/JeiStarterMixin.java @@ -27,5 +27,4 @@ public abstract class JeiStarterMixin { private static void grs$onSendRuntime(CallbackInfo ci) { JeiPlugin.afterRuntimeAvailable(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/ModRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/ModRegistryAccessor.java index dcf560a5a..8634c2327 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/ModRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/jei/ModRegistryAccessor.java @@ -10,5 +10,4 @@ public interface ModRegistryAccessor { @Accessor ListMultiMap getRecipeCatalysts(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LoadTableEventMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LoadTableEventMixin.java index 4cbc8270f..3608e3506 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LoadTableEventMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LoadTableEventMixin.java @@ -26,5 +26,4 @@ private void injection(CallbackInfo ci) { VanillaModule.loot.tables.putAll(this.registeredLootTables.asMap()); MinecraftForge.EVENT_BUS.post(new LootTablesLoadedEvent()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootPoolAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootPoolAccessor.java index ef91493a3..dd3c3af50 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootPoolAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootPoolAccessor.java @@ -12,5 +12,4 @@ public interface LootPoolAccessor { @Accessor List getLootEntries(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootTableAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootTableAccessor.java index b25ec5f7b..709d6d8df 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootTableAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/loot/LootTableAccessor.java @@ -12,5 +12,4 @@ public interface LootTableAccessor { @Accessor("pools") List getPools(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/CrushingTableRecipeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/CrushingTableRecipeManagerAccessor.java index b7de82979..10a428c9a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/CrushingTableRecipeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/CrushingTableRecipeManagerAccessor.java @@ -14,5 +14,4 @@ public interface CrushingTableRecipeManagerAccessor { static List getRecipes() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/GasificationUnitRecipeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/GasificationUnitRecipeManagerAccessor.java index 719a890ff..4cf19342f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/GasificationUnitRecipeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/GasificationUnitRecipeManagerAccessor.java @@ -14,5 +14,4 @@ public interface GasificationUnitRecipeManagerAccessor { static List getRecipes() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/HydraulicPressRecipeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/HydraulicPressRecipeManagerAccessor.java index d73479b51..fd213c51a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/HydraulicPressRecipeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/HydraulicPressRecipeManagerAccessor.java @@ -14,5 +14,4 @@ public interface HydraulicPressRecipeManagerAccessor { static List getRecipes() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/ThermopileRecipeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/ThermopileRecipeManagerAccessor.java index eedbc2253..ff1d8d7fd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/ThermopileRecipeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/magneticraft/ThermopileRecipeManagerAccessor.java @@ -14,5 +14,4 @@ public interface ThermopileRecipeManagerAccessor { static List getRecipeList() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRecipeAccessor.java index f109549c7..20f9616bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRecipeAccessor.java @@ -13,5 +13,4 @@ public interface PlasticMixerRecipeAccessor { static PlasticMixerRegistry.PlasticMixerRecipe createPlasticMixerRecipe(FluidStack fluidStack, ItemStack itemStack, int temperature, boolean allowMelting, boolean allowSolidifying, boolean useDye, int meta) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRegistryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRegistryAccessor.java index c7f8fec14..a6f41aaaf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRegistryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pneumaticcraft/PlasticMixerRegistryAccessor.java @@ -20,5 +20,4 @@ public interface PlasticMixerRegistryAccessor { @Accessor List getRecipes(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/ClayKilnRecipesAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/ClayKilnRecipesAccessor.java index c0c8cbfab..5646eebbf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/ClayKilnRecipesAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/ClayKilnRecipesAccessor.java @@ -20,5 +20,4 @@ static List getRecipes() { static ClayKilnRecipes createClayKilnRecipes(ItemStack output, ItemStack input, int itemCookTime) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/StoneAnvilRecipesAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/StoneAnvilRecipesAccessor.java index eeffd1667..6b0b38534 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/StoneAnvilRecipesAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/StoneAnvilRecipesAccessor.java @@ -20,5 +20,4 @@ static List getRecipes() { static StoneAnvilRecipes createStoneAnvilRecipes(ItemStack output, ItemStack input) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WaterSawRecipesAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WaterSawRecipesAccessor.java index bec3d005f..49c0d673a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WaterSawRecipesAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WaterSawRecipesAccessor.java @@ -20,5 +20,4 @@ static List getRecipes() { static WaterSawRecipes createWaterSawRecipes(ItemStack output, ItemStack input, int choppingTime) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WoodenBasinRecipesAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WoodenBasinRecipesAccessor.java index 1b7069b87..4c0701a23 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WoodenBasinRecipesAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/primal_tech/WoodenBasinRecipesAccessor.java @@ -21,5 +21,4 @@ static List getRecipes() { static WoodenBasinRecipes createWoodenBasinRecipes(ItemStack output, FluidStack fluidIn, Object... input) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/projecte/WorldHelperAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/projecte/WorldHelperAccessor.java index 7a24460b6..858918aab 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/projecte/WorldHelperAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/projecte/WorldHelperAccessor.java @@ -19,5 +19,4 @@ static List> getPeacefuls() { static List> getMobs() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/techreborn/RollingMachineRecipeWrapperMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/techreborn/RollingMachineRecipeWrapperMixin.java index d182aa1ca..b2d18bc79 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/techreborn/RollingMachineRecipeWrapperMixin.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/techreborn/RollingMachineRecipeWrapperMixin.java @@ -20,5 +20,4 @@ private static void useCustomGroovyScriptRecipe(IJeiHelpers jeiHelpers, IRecipe if (baseRecipe instanceof ShapelessCraftingRecipe r) cir.setReturnValue(new RollingMachineRecipeWrapper(new ShapelessRecipeWrapper<>(jeiHelpers, r))); if (baseRecipe instanceof ShapedCraftingRecipe r) cir.setReturnValue(new RollingMachineRecipeWrapper(new ShapedRecipeWrapper(jeiHelpers, r))); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerManagerAccessor.java index 38254bb70..fd1cd25da 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerManagerAccessor.java @@ -26,5 +26,4 @@ static Set getValidationSet() { static Set getValidationFluids() { throw new AssertionError(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerRecipeAccessor.java index 6ead0c54a..da4c253ec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/BrewerRecipeAccessor.java @@ -13,5 +13,4 @@ public interface BrewerRecipeAccessor { static BrewerManager.BrewerRecipe createBrewerRecipe(ItemStack input, FluidStack inputFluid, FluidStack outputFluid, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeManagerAccessor.java index 346c8bc43..ebdec4a7a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeManagerAccessor.java @@ -19,5 +19,4 @@ static Map static Map getRecipeMapMobs() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeRecipeAccessor.java index 9b6390876..4e896553f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CentrifugeRecipeAccessor.java @@ -15,8 +15,9 @@ public interface CentrifugeRecipeAccessor { @Invoker("") static CentrifugeManager.CentrifugeRecipe createCentrifugeRecipe(ItemStack input, @Nullable List output, - @Nullable List chance, @Nullable FluidStack fluid, int energy) { + @Nullable List chance, + @Nullable FluidStack fluid, + int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ChargerManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ChargerManagerAccessor.java index 52d5c1e77..29dc8e2b8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ChargerManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ChargerManagerAccessor.java @@ -14,5 +14,4 @@ public interface ChargerManagerAccessor { static Map getRecipeMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorManagerAccessor.java index a7fc024bf..8645caf88 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorManagerAccessor.java @@ -29,5 +29,4 @@ static Map ge static Map getRecipeMapGear() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorRecipeAccessor.java index b234bffef..177f7120b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompactorRecipeAccessor.java @@ -12,5 +12,4 @@ public interface CompactorRecipeAccessor { static CompactorManager.CompactorRecipe createCompactorRecipe(ItemStack input, ItemStack output, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompressionManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompressionManagerAccessor.java index 43e344bbd..076f737c9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompressionManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CompressionManagerAccessor.java @@ -12,5 +12,4 @@ public interface CompressionManagerAccessor { static Object2IntOpenHashMap getFuelMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CoolantManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CoolantManagerAccessor.java index d6b2162f5..73b6e2bb2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CoolantManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CoolantManagerAccessor.java @@ -17,5 +17,4 @@ static Object2IntOpenHashMap getCoolantMap() { static Object2IntOpenHashMap getCoolantFactorMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleManagerAccessor.java index 6aa4826d0..cc536c32c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleManagerAccessor.java @@ -20,5 +20,4 @@ static Map getR static Set getLavaSet() { throw new AssertionError(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleRecipeAccessor.java index c38a29622..52111888a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/CrucibleRecipeAccessor.java @@ -13,5 +13,4 @@ public interface CrucibleRecipeAccessor { static CrucibleManager.CrucibleRecipe createCrucibleRecipe(ItemStack input, FluidStack output, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/DiffuserManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/DiffuserManagerAccessor.java index dc7739f83..1ec0336ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/DiffuserManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/DiffuserManagerAccessor.java @@ -18,5 +18,4 @@ static TObjectIntHashMap getReagentAmpMap() { static TObjectIntHashMap getReagentDurMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterManagerAccessor.java index 7dc6227ed..cda61c70d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterManagerAccessor.java @@ -26,5 +26,4 @@ static Set getValidationSet() { static Set getLockSet() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterRecipeAccessor.java index af70bf54c..de099af81 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnchanterRecipeAccessor.java @@ -12,5 +12,4 @@ public interface EnchanterRecipeAccessor { static EnchanterManager.EnchanterRecipe createEnchanterRecipe(ItemStack primaryInput, ItemStack secondaryInput, ItemStack output, int experience, int energy, EnchanterManager.Type type) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnervationManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnervationManagerAccessor.java index 090207415..577fd2cc0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnervationManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/EnervationManagerAccessor.java @@ -13,5 +13,4 @@ public interface EnervationManagerAccessor { static TObjectIntHashMap getFuelMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderManagerAccessor.java index cafb68e30..cfc8df4a3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderManagerAccessor.java @@ -31,5 +31,4 @@ static List getOutputListIgneous() { static List getOutputListSedimentary() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderRecipeAccessor.java index cb36d1d0f..ee17f47de 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ExtruderRecipeAccessor.java @@ -13,5 +13,4 @@ public interface ExtruderRecipeAccessor { static ExtruderManager.ExtruderRecipe createExtruderRecipe(ItemStack output, FluidStack inputHot, FluidStack inputCold, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerManagerAccessor.java index 133d640a1..e9c8bbcd2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerManagerAccessor.java @@ -19,5 +19,4 @@ static Map get static Map getRecipeMapReverse() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerRecipeAccessor.java index 5c36f1844..cd5a4a1cc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FactorizerRecipeAccessor.java @@ -12,5 +12,4 @@ public interface FactorizerRecipeAccessor { static FactorizerManager.FactorizerRecipe createFactorizerRecipe(ItemStack input, ItemStack output) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FisherManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FisherManagerAccessor.java index 1ff2631bf..7aea5a89f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FisherManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FisherManagerAccessor.java @@ -36,5 +36,4 @@ static void setTotalWeight(int totalWeight) { static TObjectIntHashMap getBaitMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceManagerAccessor.java index 884cda3a0..a9adb060f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceManagerAccessor.java @@ -25,5 +25,4 @@ static Map getRecipe static Set getFoodSet() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceRecipeAccessor.java index 63d2f04f5..2da83126d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/FurnaceRecipeAccessor.java @@ -17,5 +17,4 @@ static FurnaceManager.FurnaceRecipe createFurnaceRecipe(ItemStack input, ItemSta static FurnaceManager.FurnaceRecipe createFurnaceRecipe(ItemStack input, ItemStack output, int energy, int creosote) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorManagerAccessor.java index 1d4e0f2b3..a991810c8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorManagerAccessor.java @@ -26,5 +26,4 @@ static Set getValidationSet() { static Set getLockSet() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorRecipeAccessor.java index d47f52c98..ebbf7c524 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/InsolatorRecipeAccessor.java @@ -12,5 +12,4 @@ public interface InsolatorRecipeAccessor { static InsolatorManager.InsolatorRecipe createInsolatorRecipe(ItemStack secondaryInput, ItemStack primaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, int energy, int water, InsolatorManager.Type type) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/MagmaticManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/MagmaticManagerAccessor.java index 4b3031691..8e46367d9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/MagmaticManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/MagmaticManagerAccessor.java @@ -12,5 +12,4 @@ public interface MagmaticManagerAccessor { static Object2IntOpenHashMap getFuelMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/NumismaticManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/NumismaticManagerAccessor.java index cb498e77f..accfe9e86 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/NumismaticManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/NumismaticManagerAccessor.java @@ -18,5 +18,4 @@ static TObjectIntHashMap getFuelMap() { static TObjectIntHashMap getGemFuelMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorManagerAccessor.java index eef0fd9c9..1e61bf3eb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorManagerAccessor.java @@ -21,5 +21,4 @@ static Map getRecipeMap() { static List getOutputList() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorRecipeAccessor.java index 37b9202b3..d2465f214 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PrecipitatorRecipeAccessor.java @@ -13,5 +13,4 @@ public interface PrecipitatorRecipeAccessor { static PrecipitatorManager.PrecipitatorRecipe createPrecipitatorRecipe(ItemStack output, FluidStack input, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerManagerAccessor.java index 1c6ab1c81..4e986871a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerManagerAccessor.java @@ -14,5 +14,4 @@ public interface PulverizerManagerAccessor { static Map getRecipeMap() { throw new AssertionError(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerRecipeAccessor.java index f5f3addf0..ecb21492f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/PulverizerRecipeAccessor.java @@ -12,5 +12,4 @@ public interface PulverizerRecipeAccessor { static PulverizerManager.PulverizerRecipe createPulverizerRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactantManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactantManagerAccessor.java index ce32119ee..c4cb347d8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactantManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactantManagerAccessor.java @@ -36,5 +36,4 @@ static Set getValidReactantsElemental() { static Set getValidFluidsElemental() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactionAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactionAccessor.java index f7527a697..3841532a9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactionAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/ReactionAccessor.java @@ -13,5 +13,4 @@ public interface ReactionAccessor { static ReactantManager.Reaction createReaction(ItemStack reactant, Fluid fluid, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryManagerAccessor.java index 440550a38..aa26342b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryManagerAccessor.java @@ -29,5 +29,4 @@ static Set getBioFluids() { static Set getFossilFluids() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryRecipeAccessor.java index d03317215..396d47b73 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/RefineryRecipeAccessor.java @@ -13,5 +13,4 @@ public interface RefineryRecipeAccessor { static RefineryManager.RefineryRecipe createRefineryRecipe(FluidStack input, FluidStack outputFluid, ItemStack outputItem, int energy, int chance) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillManagerAccessor.java index 68d590b36..4b66d5872 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillManagerAccessor.java @@ -14,5 +14,4 @@ public interface SawmillManagerAccessor { static Map getRecipeMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillRecipeAccessor.java index b65abc2b3..77f97ac9e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SawmillRecipeAccessor.java @@ -12,5 +12,4 @@ public interface SawmillRecipeAccessor { static SawmillManager.SawmillRecipe createSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterManagerAccessor.java index e98891792..f331c781e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterManagerAccessor.java @@ -26,5 +26,4 @@ static Set getValidationSet() { static Set getLockSet() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterRecipeAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterRecipeAccessor.java index 4507f8301..1569bcafe 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterRecipeAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SmelterRecipeAccessor.java @@ -12,5 +12,4 @@ public interface SmelterRecipeAccessor { static SmelterManager.SmelterRecipe createSmelterRecipe(ItemStack secondaryInput, ItemStack primaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, int energy) { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SteamManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SteamManagerAccessor.java index 8fdf62a64..afd67aba0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SteamManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/SteamManagerAccessor.java @@ -13,5 +13,4 @@ public interface SteamManagerAccessor { static TObjectIntHashMap getFuelMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TapperManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TapperManagerAccessor.java index e38b2beee..b167ad795 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TapperManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TapperManagerAccessor.java @@ -34,5 +34,4 @@ static SetMultimap getLeafMap() { static TObjectIntHashMap getFertilizerMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TransposerManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TransposerManagerAccessor.java index 553512833..1de51cfcb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TransposerManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/TransposerManagerAccessor.java @@ -32,5 +32,4 @@ static Map getContainerOverrid static Set getValidationSet() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/XpCollectorManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/XpCollectorManagerAccessor.java index 9501aaaf6..35f39873e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/XpCollectorManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/thermalexpansion/XpCollectorManagerAccessor.java @@ -18,5 +18,4 @@ static TObjectIntHashMap getCatalystMap() { static TObjectIntHashMap getCatalystFactorMap() { throw new UnsupportedOperationException(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropAccessor.java index 2327914be..ef10c9956 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropAccessor.java @@ -22,5 +22,4 @@ public interface CustomDropAccessor { @Accessor HashMap getSizeMap(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropsRepositoryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropsRepositoryAccessor.java index 13ab7fb7d..d8f2d8880 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropsRepositoryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/CustomDropsRepositoryAccessor.java @@ -11,5 +11,4 @@ public interface CustomDropsRepositoryAccessor { @Accessor List getDrops(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/PolicyRepositoryAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/PolicyRepositoryAccessor.java index 612074309..b66e6025b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/PolicyRepositoryAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/PolicyRepositoryAccessor.java @@ -40,5 +40,4 @@ public interface PolicyRepositoryAccessor { @Accessor List getExternalGenerateOnlyList(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/WootConfigurationManagerAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/WootConfigurationManagerAccessor.java index 4670ac45e..24b2b7fe5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/WootConfigurationManagerAccessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/woot/WootConfigurationManagerAccessor.java @@ -26,5 +26,4 @@ public interface WootConfigurationManagerAccessor { @Invoker String callMakeKey(WootMobName wootMobName, EnumConfigKey configKey); - } 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 75e965fec..44d2a1c73 100644 --- a/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java +++ b/src/main/java/com/cleanroommc/groovyscript/core/visitors/StaticVerifierVisitor.java @@ -90,7 +90,9 @@ public void visitCode() { Label label8 = new Label(); mv.visitJumpInsn(IFNE, label8); mv.visitLabel(label7); - mv.visitFrame(Opcodes.F_APPEND, 1, new Object[]{"org/codehaus/groovy/ast/FieldNode"}, 0, null); + mv.visitFrame(Opcodes.F_APPEND, 1, new Object[]{ + "org/codehaus/groovy/ast/FieldNode" + }, 0, null); mv.visitMethodInsn(INVOKESTATIC, "com/cleanroommc/groovyscript/GroovyScript", "getSandbox", "()Lcom/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox;", false); mv.visitMethodInsn(INVOKEVIRTUAL, "com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox", "getBindings", "()Ljava/util/Map;", false); mv.visitVarInsn(ALOAD, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/AdmonitionBuilder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/AdmonitionBuilder.java index 75446f9e3..6d4601019 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/AdmonitionBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/AdmonitionBuilder.java @@ -81,5 +81,4 @@ public String generate(IFormat format) { return out.toString(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java index 293165340..8a2e8986c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Builder.java @@ -21,11 +21,14 @@ public class Builder { - private static final Char2CharMap commaSeparatedParts = new Char2CharArrayMap() {{ - put(']', '['); - put('\'', '\''); - defaultReturnValue(Character.MIN_VALUE); - }}; + private static final Char2CharMap commaSeparatedParts = new Char2CharArrayMap() { + + { + put(']', '['); + put('\'', '\''); + defaultReturnValue(Character.MIN_VALUE); + } + }; private final String reference; private final Method builderMethod; @@ -57,16 +60,16 @@ private static Map gatherFields(Class builderClas List allFields = getAllFields(builderClass); for (Field field : allFields) { List annotations = Stream.of( - // Attached to the builder method's requirements field, an uncommon location for specific overrides - Arrays.stream(annotation.requirement()).filter(r -> r.property().equals(field.getName())), - // Attached to the class or any parent classes, to create/override requirements set in the parent - getPropertyAnnotationsFromClassRecursive(builderClass).stream().filter(r -> r.property().equals(field.getName())), - // Attached to the field, the typical place for property information to be created - Arrays.stream(field.getAnnotationsByType(Property.class)).filter(r -> { - if (r.property().isEmpty() || r.property().equals(field.getName())) return true; - GroovyLog.get().warn("Property Annotation had element property '{}' set to a value that wasn't empty or equal to field '{}' in class '{}'.", r.property(), field, builderClass); - return false; - })) + // Attached to the builder method's requirements field, an uncommon location for specific overrides + Arrays.stream(annotation.requirement()).filter(r -> r.property().equals(field.getName())), + // Attached to the class or any parent classes, to create/override requirements set in the parent + getPropertyAnnotationsFromClassRecursive(builderClass).stream().filter(r -> r.property().equals(field.getName())), + // Attached to the field, the typical place for property information to be created + Arrays.stream(field.getAnnotationsByType(Property.class)).filter(r -> { + if (r.property().isEmpty() || r.property().equals(field.getName())) return true; + GroovyLog.get().warn("Property Annotation had element property '{}' set to a value that wasn't empty or equal to field '{}' in class '{}'.", r.property(), field, builderClass); + return false; + })) .flatMap(x -> x) .sorted((left, right) -> ComparisonChain.start().compare(left.hierarchy(), right.hierarchy()).result()) .collect(Collectors.toList()); @@ -92,11 +95,13 @@ private static Map> gatherMethods(Class bui } } - fieldToModifyingMethods.forEach((key, value) -> value.sort((left, right) -> ComparisonChain.start() - .compare(left.getAnnotation().priority(), right.getAnnotation().priority()) - .compare(left.getMethod().getName().length(), right.getMethod().getName().length()) - .compare(left.getMethod().getName(), right.getMethod().getName(), String::compareToIgnoreCase) - .result())); + fieldToModifyingMethods.forEach( + (key, value) -> value.sort( + (left, right) -> ComparisonChain.start() + .compare(left.getAnnotation().priority(), right.getAnnotation().priority()) + .compare(left.getMethod().getName().length(), right.getMethod().getName().length()) + .compare(left.getMethod().getName(), right.getMethod().getName(), String::compareToIgnoreCase) + .result())); return fieldToModifyingMethods; } @@ -104,18 +109,20 @@ private static Map> gatherMethods(Class bui private static List gatherRegistrationMethods(Class builderClass) { return Arrays.stream(builderClass.getMethods()) .filter(x -> x.isAnnotationPresent(RecipeBuilderRegistrationMethod.class)) - .sorted((left, right) -> ComparisonChain.start() - .compare(left.getAnnotation(RecipeBuilderRegistrationMethod.class).hierarchy(), right.getAnnotation(RecipeBuilderRegistrationMethod.class).hierarchy()) - // Specifically de-prioritize Object classes - .compareFalseFirst(left.getReturnType() == Object.class, right.getReturnType() == Object.class) - .result()) + .sorted( + (left, right) -> ComparisonChain.start() + .compare(left.getAnnotation(RecipeBuilderRegistrationMethod.class).hierarchy(), right.getAnnotation(RecipeBuilderRegistrationMethod.class).hierarchy()) + // Specifically de-prioritize Object classes + .compareFalseFirst(left.getReturnType() == Object.class, right.getReturnType() == Object.class) + .result()) // Ensure only the first method with a given name is used .filter(distinctByKey(Method::getName)) - .sorted((left, right) -> ComparisonChain.start() - .compare(left.getAnnotation(RecipeBuilderRegistrationMethod.class).priority(), right.getAnnotation(RecipeBuilderRegistrationMethod.class).priority()) - .compare(left.getName().length(), right.getName().length()) - .compare(left.getName(), right.getName(), String::compareToIgnoreCase) - .result()) + .sorted( + (left, right) -> ComparisonChain.start() + .compare(left.getAnnotation(RecipeBuilderRegistrationMethod.class).priority(), right.getAnnotation(RecipeBuilderRegistrationMethod.class).priority()) + .compare(left.getName().length(), right.getName().length()) + .compare(left.getName(), right.getName(), String::compareToIgnoreCase) + .result()) .collect(Collectors.toList()); } @@ -275,7 +282,8 @@ public String documentMethods() { public StringBuilder documentFields() { StringBuilder out = new StringBuilder(); - fields.values().stream() + fields.values() + .stream() .sorted() .filter(FieldDocumentation::isUsed) .forEach(fieldDocumentation -> { @@ -304,14 +312,16 @@ public StringBuilder documentFields() { if (recipeBuilderMethods == null || recipeBuilderMethods.isEmpty()) { GroovyLog.get().warn("Couldn't find any methods targeting field '{}' in recipe builder '{}'", fieldDocumentation.getField().getName(), reference); } else { - out.append(new CodeBlockBuilder() - .line(recipeBuilderMethods.stream() - .sorted() - .map(RecipeBuilderMethod::shortMethodSignature) - .distinct() - .collect(Collectors.toList())) - .indentation(1) - .toString()); + out.append( + new CodeBlockBuilder() + .line( + recipeBuilderMethods.stream() + .sorted() + .map(RecipeBuilderMethod::shortMethodSignature) + .distinct() + .collect(Collectors.toList())) + .indentation(1) + .toString()); } }); return out; @@ -413,7 +423,9 @@ public boolean hasComparison() { return true; //annotations.stream().anyMatch(x -> x.comp().types().length != 0 || x.valid().length != 0); } - @SuppressWarnings({"deprecation", "SimplifyOptionalCallChains"}) + @SuppressWarnings({ + "deprecation", "SimplifyOptionalCallChains" + }) public String getComparison() { Optional comparison = annotations.stream().map(Property::valid).filter(valid -> valid.length != 0).findFirst(); if (!comparison.isPresent()) { @@ -469,7 +481,6 @@ public int compareTo(@NotNull FieldDocumentation comp) { .compare(this.getField().getName(), comp.getField().getName(), String::compareToIgnoreCase) .result(); } - } @@ -514,5 +525,4 @@ public int compareTo(@NotNull RecipeBuilderMethod comp) { .result(); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/CodeBlockBuilder.java b/src/main/java/com/cleanroommc/groovyscript/documentation/CodeBlockBuilder.java index 1c2dc6caa..fcbd41729 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/CodeBlockBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/CodeBlockBuilder.java @@ -118,5 +118,4 @@ public List generate(IFormat format) { public String toString() { return String.join("\n", generate()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java index 0f1c7a891..b5762d50c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Documentation.java @@ -121,6 +121,4 @@ public static String ensurePeriod(String string) { if (string.isEmpty()) return ""; return PUNCTUATION_CHARACTERS.contains(string.charAt(string.length() - 1)) ? string : string + "."; } - } - diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java index d880f51c6..3418e305a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Exporter.java @@ -62,13 +62,16 @@ private static String convertVarArgs(String name) { public static void generateWiki(File folder, GroovyContainer mod) { List fileLinks = new ArrayList<>(); - List registries = mod.get().getRegistries().stream() + List registries = mod.get() + .getRegistries() + .stream() .filter(x -> x.getClass().isAnnotationPresent(RegistryDescription.class)) .distinct() - .sorted((left, right) -> ComparisonChain.start() - .compare(left.getClass().getAnnotation(RegistryDescription.class).priority(), right.getClass().getAnnotation(RegistryDescription.class).priority()) - .compare(left.getName(), right.getName()) - .result()) + .sorted( + (left, right) -> ComparisonChain.start() + .compare(left.getClass().getAnnotation(RegistryDescription.class).priority(), right.getClass().getAnnotation(RegistryDescription.class).priority()) + .compare(left.getName(), right.getName()) + .result()) .collect(Collectors.toList()); if (registries.isEmpty()) return; @@ -90,18 +93,30 @@ public static void generateWiki(File folder, GroovyContainer { @@ -133,18 +148,25 @@ public static void generateExamples(String target, GroovyContainer imports = new ArrayList<>(); // Preprocessor to only run script if the mod is loaded - header.append("\n").append("// Auto generated groovyscript example file").append("\n") - .append("// MODS_LOADED: ").append(mod.getModId()).append("\n"); + header.append("\n") + .append("// Auto generated groovyscript example file") + .append("\n") + .append("// MODS_LOADED: ") + .append(mod.getModId()) + .append("\n"); // Iterate through every registry of the mod once, in alphabetical order. - List registries = mod.get().getRegistries().stream() + List registries = mod.get() + .getRegistries() + .stream() .distinct() .filter(x -> x.getClass().isAnnotationPresent(RegistryDescription.class)) .filter(x -> x.getClass().getAnnotation(RegistryDescription.class).location().equals(target)) - .sorted((left, right) -> ComparisonChain.start() - .compare(left.getClass().getAnnotation(RegistryDescription.class).priority(), right.getClass().getAnnotation(RegistryDescription.class).priority()) - .compare(left.getName(), right.getName()) - .result()) + .sorted( + (left, right) -> ComparisonChain.start() + .compare(left.getClass().getAnnotation(RegistryDescription.class).priority(), right.getClass().getAnnotation(RegistryDescription.class).priority()) + .compare(left.getName(), right.getName()) + .result()) .collect(Collectors.toList()); if (registries.isEmpty()) return; @@ -160,7 +182,9 @@ public static void generateExamples(String target, GroovyContainer header.append("import ").append(i).append("\n")); // Print that the script was loaded at the end of the header, after any imports have been added. - header.append("\n").append(String.format(PRINT_MOD_DETECTED, mod.getModId())).append("\n\n") + header.append("\n") + .append(String.format(PRINT_MOD_DETECTED, mod.getModId())) + .append("\n\n") .append(body); try { diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java index ef9b644a6..62ffecd78 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/Registry.java @@ -72,7 +72,7 @@ public Registry(GroovyContainer mod, INamed r private static Map generateTypes(Class registryClass) { var types = new HashMap(); if (registryClass.getGenericSuperclass() instanceof ParameterizedType parameterizedType) { - if (parameterizedType.getRawType() instanceof Class typeClass) { + if (parameterizedType.getRawType() instanceof ClasstypeClass) { var parameters = typeClass.getTypeParameters(); var args = parameterizedType.getActualTypeArguments(); for (int i = 0; i < parameters.length && i < args.length; i++) { @@ -84,38 +84,41 @@ private static Map generateTypes(Class registryClass) { } private static List sortGrSRecipeBuilderDescriptionMethods(List methods) { - methods.sort((left, right) -> ComparisonChain.start() - .compareFalseFirst(left.isAnnotationPresent(RecipeBuilderDescription.class), right.isAnnotationPresent(RecipeBuilderDescription.class)) - .compare(left.getAnnotation(RecipeBuilderDescription.class).priority(), right.getAnnotation(RecipeBuilderDescription.class).priority()) - .compare(left.getName(), right.getName(), String::compareToIgnoreCase) - .compare(Exporter.simpleSignature(left), Exporter.simpleSignature(right), String::compareToIgnoreCase) - .result()); + methods.sort( + (left, right) -> ComparisonChain.start() + .compareFalseFirst(left.isAnnotationPresent(RecipeBuilderDescription.class), right.isAnnotationPresent(RecipeBuilderDescription.class)) + .compare(left.getAnnotation(RecipeBuilderDescription.class).priority(), right.getAnnotation(RecipeBuilderDescription.class).priority()) + .compare(left.getName(), right.getName(), String::compareToIgnoreCase) + .compare(Exporter.simpleSignature(left), Exporter.simpleSignature(right), String::compareToIgnoreCase) + .result()); return methods; } private static List sortGrSMethodDescriptionMethods(List methods) { - methods.sort((left, right) -> ComparisonChain.start() - .compareFalseFirst(left.isAnnotationPresent(MethodDescription.class), right.isAnnotationPresent(MethodDescription.class)) - .compare(left.getAnnotation(MethodDescription.class).priority(), right.getAnnotation(MethodDescription.class).priority()) - .compare(left.getName(), right.getName(), String::compareToIgnoreCase) - .compare(Exporter.simpleSignature(left), Exporter.simpleSignature(right), String::compareToIgnoreCase) - .result()); + methods.sort( + (left, right) -> ComparisonChain.start() + .compareFalseFirst(left.isAnnotationPresent(MethodDescription.class), right.isAnnotationPresent(MethodDescription.class)) + .compare(left.getAnnotation(MethodDescription.class).priority(), right.getAnnotation(MethodDescription.class).priority()) + .compare(left.getName(), right.getName(), String::compareToIgnoreCase) + .compare(Exporter.simpleSignature(left), Exporter.simpleSignature(right), String::compareToIgnoreCase) + .result()); return methods; } private static List getExamples(Method method) { return method.isAnnotationPresent(MethodDescription.class) - ? new ArrayList<>(Arrays.asList(method.getAnnotation(MethodDescription.class).example())) - : new ArrayList<>(); + ? new ArrayList<>(Arrays.asList(method.getAnnotation(MethodDescription.class).example())) + : new ArrayList<>(); } private static List sortExamples(List examples) { - examples.sort((left, right) -> ComparisonChain.start() - .compare(left.priority(), right.priority()) - .compareFalseFirst(left.commented(), right.commented()) - .compare(left.value().length(), right.value().length()) - .compare(left.value(), right.value()) - .result()); + examples.sort( + (left, right) -> ComparisonChain.start() + .compare(left.priority(), right.priority()) + .compareFalseFirst(left.commented(), right.commented()) + .compare(left.value().length(), right.value().length()) + .compare(left.value(), right.value()) + .result()); return examples; } @@ -132,8 +135,9 @@ public String getTitle() { } public String getDescription() { - return Documentation.ensurePeriod(Documentation.translate(description.description().isEmpty() ? String.format("%s.description", baseTranslationKey) : description.description()) - .replace("\"", "\\\"")); + return Documentation.ensurePeriod( + Documentation.translate(description.description().isEmpty() ? String.format("%s.description", baseTranslationKey) : description.description()) + .replace("\"", "\\\"")); } public String exampleBlock() { @@ -181,22 +185,24 @@ private String generateDescription() { out.append(getDescription()).append("\n\n"); if (!description.isFullyDocumented()) { - out.append(new AdmonitionBuilder() - .type(Admonition.Type.WARNING) - .note(I18n.format("groovyscript.wiki.not_fully_documented")) - .generate()); + out.append( + new AdmonitionBuilder() + .type(Admonition.Type.WARNING) + .note(I18n.format("groovyscript.wiki.not_fully_documented")) + .generate()); out.append("\n\n"); } Admonition[] admonition = description.admonition(); for (Admonition note : admonition) { - out.append(new AdmonitionBuilder() - .type(note.type()) - .title(note.title()) - .hasTitle(note.hasTitle()) - .format(note.format()) - .note(Documentation.ensurePeriod(Documentation.translate(note.value()))) - .generate()); + out.append( + new AdmonitionBuilder() + .type(note.type()) + .title(note.title()) + .hasTitle(note.hasTitle()) + .format(note.format()) + .note(Documentation.ensurePeriod(Documentation.translate(note.value()))) + .generate()); out.append("\n\n"); } return out.toString(); @@ -206,41 +212,48 @@ private String generateIdentifier() { StringBuilder out = new StringBuilder(); out.append("## ").append(I18n.format("groovyscript.wiki.identifier")).append("\n\n").append(I18n.format("groovyscript.wiki.import_instructions")).append("\n\n"); - List packages = mod.getAliases().stream() + List packages = mod.getAliases() + .stream() .flatMap(modID -> registry.getAliases().stream().map(alias -> String.format("mods.%s.%s", modID, alias))) .collect(Collectors.toList()); int target = packages.indexOf(reference); packages.set(target, reference + "/*()!*/"); - out.append(new CodeBlockBuilder() - .line(packages) - .annotation(I18n.format("groovyscript.wiki.defaultPackage")) - // Highlighting and focusing are based on the line count, and is 1-indexed - .highlight(String.valueOf(1 + target)) - .focus(1 + target) - .toString()); + out.append( + new CodeBlockBuilder() + .line(packages) + .annotation(I18n.format("groovyscript.wiki.defaultPackage")) + // Highlighting and focusing are based on the line count, and is 1-indexed + .highlight(String.valueOf(1 + target)) + .focus(1 + target) + .toString()); return out.toString(); } private String recipeBuilder() { StringBuilder out = new StringBuilder(); - out.append("### ").append(I18n.format("groovyscript.wiki.recipe_builder")).append("\n\n") - .append(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())).append("\n\n") - .append(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())).append("\n\n"); + out.append("### ") + .append(I18n.format("groovyscript.wiki.recipe_builder")) + .append("\n\n") + .append(I18n.format("groovyscript.wiki.uses_recipe_builder", getTitle())) + .append("\n\n") + .append(I18n.format("groovyscript.wiki.recipe_builder_note", Documentation.DEFAULT_FORMAT.linkToBuilder())) + .append("\n\n"); for (int i = 0; i < recipeBuilderMethods.size(); i++) { Builder builder = new Builder(recipeBuilderMethods.get(i), reference, baseTranslationKey); - out.append(new AdmonitionBuilder() - .type(Admonition.Type.ABSTRACT) - .hasTitle(true) - .title(methodExample(recipeBuilderMethods.get(i))) - .note(builder.documentMethods().split("\n")) - .note("\n") - .note(builder.builderAdmonition().split("\n")) - .note("\n") - .generate()); + out.append( + new AdmonitionBuilder() + .type(Admonition.Type.ABSTRACT) + .hasTitle(true) + .title(methodExample(recipeBuilderMethods.get(i))) + .note(builder.documentMethods().split("\n")) + .note("\n") + .note(builder.builderAdmonition().split("\n")) + .note("\n") + .generate()); if (i < recipeBuilderMethods.size() - 1) out.append("\n\n"); } return out.toString(); @@ -297,13 +310,15 @@ public String documentMethods(List methods, boolean preventExamples) { } if (!exampleLines.isEmpty() && !preventExamples) { - out.append(new AdmonitionBuilder() - .type(Admonition.Type.EXAMPLE) - .note(new CodeBlockBuilder() - .line(exampleLines) - .annotation(annotations) - .generate()) - .generate()); + out.append( + new AdmonitionBuilder() + .type(Admonition.Type.EXAMPLE) + .note( + new CodeBlockBuilder() + .line(exampleLines) + .annotation(annotations) + .generate()) + .generate()); out.append("\n"); } @@ -317,15 +332,16 @@ private String methodDescription(Method method) { // If `desc` isn't defined, check the `registryDefault` key. If it exists, use it. // Then, check the `globalDefault` key. If it exists use it. Otherwise, we want to still use the `registryDefault` for logging a missing key. String lang = desc.isEmpty() - ? I18n.hasKey(registryDefault) || !I18n.hasKey(globalDefault) ? registryDefault : globalDefault - : desc; - - return String.format("- %s:\n\n%s", - Documentation.translate(lang), - new CodeBlockBuilder() - .line(methodExample(method, Exporter.simpleSignature(method, types))) - .indentation(1) - .toString()); + ? I18n.hasKey(registryDefault) || !I18n.hasKey(globalDefault) ? registryDefault : globalDefault + : desc; + + return String.format( + "- %s:\n\n%s", + Documentation.translate(lang), + new CodeBlockBuilder() + .line(methodExample(method, Exporter.simpleSignature(method, types))) + .indentation(1) + .toString()); } private String methodExample(Method method, String example) { @@ -349,5 +365,4 @@ private String examples(Method method) { } return out.toString(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java index 1ed8efc3f..be39cf5b3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/IFormat.java @@ -63,5 +63,4 @@ public interface IFormat { * @return if the format uses focus in codeblocks. Focus being true also means that annotations are disabled */ boolean usesFocusInCodeBlocks(); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java index 35b18d8b6..6dd4e8716 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/MKDocsMaterial.java @@ -58,5 +58,4 @@ public boolean requiresNavFile() { public boolean usesFocusInCodeBlocks() { return false; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/OutputFormat.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/OutputFormat.java index 6338088c3..9f39fb5d7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/OutputFormat.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/OutputFormat.java @@ -6,7 +6,5 @@ public class OutputFormat { public static final MKDocsMaterial MKDOCS_MATERIAL = new MKDocsMaterial(); public static final VitePress VITEPRESS = new VitePress(); - private OutputFormat() { - } - + private OutputFormat() {} } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java b/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java index ac8c6ef18..357256f13 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/format/VitePress.java @@ -64,5 +64,4 @@ public boolean requiresNavFile() { public boolean usesFocusInCodeBlocks() { return true; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/BasicLinkGenerator.java b/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/BasicLinkGenerator.java index 526af2f07..4e0aebd7a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/BasicLinkGenerator.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/BasicLinkGenerator.java @@ -48,5 +48,4 @@ protected String trimmedLocation(String location) { public String convert(String location) { return domain() + path() + trimmedLocation(location) + extension(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/LinkGeneratorHooks.java b/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/LinkGeneratorHooks.java index 5dc13870e..669f519c1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/LinkGeneratorHooks.java +++ b/src/main/java/com/cleanroommc/groovyscript/documentation/linkgenerator/LinkGeneratorHooks.java @@ -25,5 +25,4 @@ public static void registerLinkGenerator(ILinkGenerator linkGenerator) { public static String convert(String mode, Class clazz) { return REGISTRY.getOrDefault(mode, DEFAULT).convert(clazz.getProtectionDomain().getCodeSource().getLocation().getPath()); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/event/EventBusExtended.java b/src/main/java/com/cleanroommc/groovyscript/event/EventBusExtended.java index c1e818bd1..f0746e89a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/EventBusExtended.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/EventBusExtended.java @@ -6,5 +6,4 @@ public interface EventBusExtended { void register(Class eventClass, EventPriority priority, IEventListener listener); - } diff --git a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java index f768bfcaa..39130c913 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java @@ -114,8 +114,7 @@ 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.getOriginalMessage().substring(CustomClickAction.PREFIX.length()))) { + if (event.getOriginalMessage().startsWith(CustomClickAction.PREFIX) && CustomClickAction.runActionHook(event.getOriginalMessage().substring(CustomClickAction.PREFIX.length()))) { event.setCanceled(true); } } @@ -172,24 +171,19 @@ public static void onGuiOpen(GuiOpenEvent event) { List warnings = new ArrayList<>(); if (!FMLLaunchHandler.isDeobfuscatedEnvironment()) { if (!Loader.isModLoaded("universaltweaks")) { - warnings.add("UniversalTweaks is not loaded! It fixes a recipe book bug by removing it.\n" + - "Consider adding UniversalTweaks to your mods and make sure to enable recipe book removal in the config"); + warnings.add("UniversalTweaks is not loaded! It fixes a recipe book bug by removing it.\n" + "Consider adding UniversalTweaks to your mods and make sure to enable recipe book removal in the config"); } else if (isUTRecipeBookEnabled()) { - warnings.add("UniversalTweaks is loaded, but the recipe book is still enabled. This will cause issue with Groovyscript!\n" + - "Please set 'Remove Recipe Book' to true in the misc category!"); + warnings.add("UniversalTweaks is loaded, but the recipe book is still enabled. This will cause issue with Groovyscript!\n" + "Please set 'Remove Recipe Book' to true in the misc category!"); } if (Loader.isModLoaded("inworldcrafting")) { - warnings.add("InWorldCrafting mod was detected. InWorldCrafting is obsolete since GroovyScript implements its functionality on its own.\n" + - "Consider using GroovyScript and removing InWorldCrafting."); + warnings.add("InWorldCrafting mod was detected. InWorldCrafting is obsolete since GroovyScript implements its functionality on its own.\n" + "Consider using GroovyScript and removing InWorldCrafting."); } } if ((GroovyScript.getRunConfig().getPackmodeConfigState() & 1) != 0) { - warnings.add("Integration with the packmode mod is enabled, but the packmode mod is not installed.\n" + - "Please disable integration or install the mod."); + warnings.add("Integration with the packmode mod is enabled, but the packmode mod is not installed.\n" + "Please disable integration or install the mod."); } if ((GroovyScript.getRunConfig().getPackmodeConfigState() & 2) != 0) { - warnings.add("Integration with the packmode mod is enabled, but packmodes are also configured in GroovyScript.\n" + - "You should use the packmode mod to configure packmodes if integration is enabled."); + warnings.add("Integration with the packmode mod is enabled, but packmodes are also configured in GroovyScript.\n" + "You should use the packmode mod to configure packmodes if integration is enabled."); } if (!warnings.isEmpty()) { event.setGui(new WarningScreen(warnings)); diff --git a/src/main/java/com/cleanroommc/groovyscript/event/GroovyEventManager.java b/src/main/java/com/cleanroommc/groovyscript/event/GroovyEventManager.java index a299dcb77..13fe3ed30 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/GroovyEventManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/GroovyEventManager.java @@ -73,8 +73,11 @@ public void listen(EventBusType eventBusType, Class eventClass, } public void listen(EventPriority priority, EventBusType eventBusType, Class eventClass, Closure eventListener) { - listen(priority, eventBusType, eventClass, - event -> ClosureHelper.call(ClosureHelper.withEnvironment(eventListener, event, true))); + listen( + priority, + eventBusType, + eventClass, + event -> ClosureHelper.call(ClosureHelper.withEnvironment(eventListener, event, true))); } @GroovyBlacklist diff --git a/src/main/java/com/cleanroommc/groovyscript/event/LootTablesLoadedEvent.java b/src/main/java/com/cleanroommc/groovyscript/event/LootTablesLoadedEvent.java index 7531c4cb7..e2a01d770 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/LootTablesLoadedEvent.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/LootTablesLoadedEvent.java @@ -146,5 +146,4 @@ public GroovyLootCondition condition(Closure condition) { return new GroovyLootCondition(condition); } } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java index 411da0f54..33db0d9e3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyFile.java @@ -719,11 +719,12 @@ public void append(Reader reader, String charset) throws IOException { * @throws FileNotFoundException if the given directory does not exist * @throws IllegalArgumentException if the provided File object does not represent a directory */ - public void eachFile(final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void eachFile(final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFile(this.internal, fileType, wrapped); } @@ -737,11 +738,12 @@ public void eachFile(final FileType fileType, @ClosureParams(value = SimpleType. * @see java.io.File#listFiles() * @see ResourceGroovyMethods#eachFile(java.io.File, groovy.io.FileType, groovy.lang.Closure) */ - public void eachFile(@ClosureParams(value = SimpleType.class, options = "java.io.File") - final Closure closure) throws FileNotFoundException, IllegalArgumentException { + public void eachFile(@ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFile(this.internal, wrapped); } @@ -756,10 +758,12 @@ public void eachFile(@ClosureParams(value = SimpleType.class, options = "java.io * @see ResourceGroovyMethods#eachFile(java.io.File, groovy.io.FileType, groovy.lang.Closure) */ public void eachDir( - @ClosureParams(value = SimpleType.class, options = "java.io.File") Closure closure) throws FileNotFoundException, IllegalArgumentException { + @ClosureParams(value = SimpleType.class, options = "java.io.File") Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachDir(this.internal, wrapped); } @@ -775,11 +779,12 @@ public void eachDir( * @throws FileNotFoundException if the given directory does not exist * @throws IllegalArgumentException if the provided File object does not represent a directory */ - public void eachFileRecurse(final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void eachFileRecurse(final FileType fileType, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFileRecurse(this.internal, fileType, wrapped); } @@ -840,23 +845,13 @@ public void eachFileRecurse(final FileType fileType, @ClosureParams(value = Simp * @see groovy.io.FileVisitResult * @see groovy.io.FileType */ - public void traverse(@NamedParam(value = "type", type = FileType.class) - @NamedParam(value = "preDir", type = Closure.class) - @NamedParam(value = "preRoot", type = Boolean.class) - @NamedParam(value = "postDir", type = Closure.class) - @NamedParam(value = "postRoot", type = Boolean.class) - @NamedParam(value = "visitRoot", type = Boolean.class) - @NamedParam(value = "maxDepth", type = Integer.class) - @NamedParam(value = "filter") - @NamedParam(value = "nameFilter") - @NamedParam(value = "excludeFilter") - @NamedParam(value = "excludeNameFilter") - @NamedParam(value = "sort", type = Closure.class) final Map options, - @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void traverse(@NamedParam(value = "type", type = FileType.class) @NamedParam(value = "preDir", type = Closure.class) @NamedParam(value = "preRoot", type = Boolean.class) @NamedParam(value = "postDir", type = Closure.class) @NamedParam(value = "postRoot", type = Boolean.class) @NamedParam(value = "visitRoot", type = Boolean.class) @NamedParam(value = "maxDepth", type = Integer.class) @NamedParam(value = "filter") @NamedParam(value = "nameFilter") @NamedParam(value = "excludeFilter") @NamedParam(value = "excludeNameFilter") @NamedParam(value = "sort", type = Closure.class) final Map options, + @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.traverse(this.internal, options, wrapped); } @@ -871,11 +866,12 @@ public void traverse(@NamedParam(value = "type", type = FileType.class) * @throws IllegalArgumentException if the provided File object does not represent a directory * @see ResourceGroovyMethods#traverse(java.io.File, java.util.Map, groovy.lang.Closure) */ - public void traverse(@ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void traverse(@ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.traverse(this.internal, wrapped); } @@ -890,19 +886,7 @@ public void traverse(@ClosureParams(value = SimpleType.class, options = "java.io * @throws IllegalArgumentException if the provided File object does not represent a directory or illegal filter combinations are supplied * @see ResourceGroovyMethods#traverse(java.io.File, java.util.Map, groovy.lang.Closure) */ - public void traverse(@NamedParam(value = "type", type = FileType.class) - @NamedParam(value = "preDir", type = Closure.class) - @NamedParam(value = "preRoot", type = Boolean.class) - @NamedParam(value = "postDir", type = Closure.class) - @NamedParam(value = "postRoot", type = Boolean.class) - @NamedParam(value = "visitRoot", type = Boolean.class) - @NamedParam(value = "maxDepth", type = Integer.class) - @NamedParam(value = "filter") - @NamedParam(value = "nameFilter") - @NamedParam(value = "excludeFilter") - @NamedParam(value = "excludeNameFilter") - @NamedParam(value = "sort", type = Closure.class) final Map options) - throws FileNotFoundException, IllegalArgumentException { + public void traverse(@NamedParam(value = "type", type = FileType.class) @NamedParam(value = "preDir", type = Closure.class) @NamedParam(value = "preRoot", type = Boolean.class) @NamedParam(value = "postDir", type = Closure.class) @NamedParam(value = "postRoot", type = Boolean.class) @NamedParam(value = "visitRoot", type = Boolean.class) @NamedParam(value = "maxDepth", type = Integer.class) @NamedParam(value = "filter") @NamedParam(value = "nameFilter") @NamedParam(value = "excludeFilter") @NamedParam(value = "excludeNameFilter") @NamedParam(value = "sort", type = Closure.class) final Map options) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); ResourceGroovyMethods.traverse(this.internal, options); } @@ -919,10 +903,12 @@ public void traverse(@NamedParam(value = "type", type = FileType.class) * @see ResourceGroovyMethods#eachFileRecurse(java.io.File, groovy.io.FileType, groovy.lang.Closure) */ public void eachFileRecurse( - @ClosureParams(value = SimpleType.class, options = "java.io.File") Closure closure) throws FileNotFoundException, IllegalArgumentException { + @ClosureParams(value = SimpleType.class, options = "java.io.File") Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFileRecurse(this.internal, wrapped); } @@ -938,11 +924,12 @@ public void eachFileRecurse( * @see ResourceGroovyMethods#eachFileRecurse(java.io.File, groovy.io.FileType, groovy.lang.Closure) */ public void eachDirRecurse( - @ClosureParams(value = SimpleType.class, options = "java.io.File") - final Closure closure) throws FileNotFoundException, IllegalArgumentException { + @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachDirRecurse(this.internal, wrapped); } @@ -972,12 +959,14 @@ public void eachDirRecurse( * @throws FileNotFoundException if the given directory does not exist * @throws IllegalArgumentException if the provided File object does not represent a directory */ - public void eachFileMatch(final FileType fileType, final Object nameFilter, - @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void eachFileMatch(final FileType fileType, + final Object nameFilter, + @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFileMatch(this.internal, fileType, nameFilter, wrapped); } @@ -993,11 +982,12 @@ public void eachFileMatch(final FileType fileType, final Object nameFilter, * @throws IllegalArgumentException if the provided File object does not represent a directory * @see ResourceGroovyMethods#eachFileMatch(java.io.File, groovy.io.FileType, java.lang.Object, groovy.lang.Closure) */ - public void eachFileMatch(final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) - throws FileNotFoundException, IllegalArgumentException { + public void eachFileMatch(final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachFileMatch(this.internal, nameFilter, wrapped); } @@ -1013,11 +1003,12 @@ public void eachFileMatch(final Object nameFilter, @ClosureParams(value = Simple * @throws IllegalArgumentException if the provided File object does not represent a directory * @see ResourceGroovyMethods#eachFileMatch(java.io.File, groovy.io.FileType, java.lang.Object, groovy.lang.Closure) */ - public void eachDirMatch(final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.io.File") - final Closure closure) throws FileNotFoundException, IllegalArgumentException { + public void eachDirMatch(final Object nameFilter, @ClosureParams(value = SimpleType.class, options = "java.io.File") final Closure closure) throws FileNotFoundException, IllegalArgumentException { checkAccessible(); - Closure wrapped = new LambdaClosure<>(closure.getOwner(), closure.getThisObject(), - args -> closure.call(new GroovyFile((File) args[0]))); + Closure wrapped = new LambdaClosure<>( + closure.getOwner(), + closure.getThisObject(), + args -> closure.call(new GroovyFile((File) args[0]))); ResourceGroovyMethods.eachDirMatch(this.internal, nameFilter, wrapped); } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java index 82cfc5362..2c7533c76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/GroovyHelper.java @@ -13,8 +13,7 @@ public class GroovyHelper { @GroovyBlacklist - private GroovyHelper() { - } + private GroovyHelper() {} public static boolean isLoaded(String mod) { return Loader.isModLoaded(mod); 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 bb452de03..47a9d34f6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/FluidStackList.java @@ -7,8 +7,7 @@ public class FluidStackList extends ArrayList { - public FluidStackList() { - } + public FluidStackList() {} public FluidStackList(Collection collection) { super(collection); diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/GroovyScriptCodeConverter.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/GroovyScriptCodeConverter.java index cc8fdafa4..a6dd9079d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/GroovyScriptCodeConverter.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/GroovyScriptCodeConverter.java @@ -172,9 +172,10 @@ public static String asGroovyCode(Potion potion, boolean colored) { public static String asGroovyCode(PotionEffect potionEffect, boolean colored) { StringBuilder builder = new StringBuilder(); - List list = Lists.newArrayList(asGroovyCode(potionEffect.getPotion(), colored), - formatNumber(potionEffect.getDuration(), colored), - formatNumber(potionEffect.getAmplifier(), colored)); + List list = Lists.newArrayList( + asGroovyCode(potionEffect.getPotion(), colored), + formatNumber(potionEffect.getDuration(), colored), + formatNumber(potionEffect.getAmplifier(), colored)); builder.append(formatInstantiation("PotionEffect", list, colored)); return builder.toString(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java index fa36a9988..8a7631a21 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java @@ -281,5 +281,4 @@ public static String asGroovyCode(String oreDict, boolean colored) { public static String asGroovyCode(IBlockState state, boolean colored) { return GroovyScriptCodeConverter.asGroovyCode(state, colored); } - } 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 e948c440f..bb711a101 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/ItemStackList.java @@ -10,8 +10,7 @@ */ public class ItemStackList extends ArrayList { - public ItemStackList() { - } + public ItemStackList() {} public ItemStackList(Collection collection) { super(collection); 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 c06ca55ff..0ceb3b1ea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/OreDictIngredient.java @@ -2,12 +2,10 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; - +import com.google.common.collect.Iterators; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.oredict.OreDictionary; - -import com.google.common.collect.Iterators; import org.jetbrains.annotations.NotNull; import java.util.Iterator; diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java index 782d195d1..a958652b1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMapper.java @@ -142,13 +142,18 @@ public List getMethodNodes() { if (methodNodes == null) { this.methodNodes = new ArrayList<>(); for (Class[] paramType : this.paramTypes) { - Parameter[] params = ArrayUtils.map(paramType, c -> new Parameter(ClassHelper.makeCached(c), ""), - new Parameter[paramType.length]); - MethodNode node = new MethodNode(this.name, Modifier.PUBLIC | Modifier.FINAL, - ClassHelper.makeCached(this.returnType), params, null, null); - node.setDeclaringClass(this.mod != null ? - ClassHelper.makeCached(this.mod.get().getClass()) : - ClassHelper.makeCached(ObjectMapperManager.class)); + Parameter[] params = ArrayUtils.map( + paramType, + c -> new Parameter(ClassHelper.makeCached(c), ""), + new Parameter[paramType.length]); + MethodNode node = new MethodNode( + this.name, + Modifier.PUBLIC | Modifier.FINAL, + ClassHelper.makeCached(this.returnType), + params, + null, + null); + node.setDeclaringClass(this.mod != null ? ClassHelper.makeCached(this.mod.get().getClass()) : ClassHelper.makeCached(ObjectMapperManager.class)); node.setNodeMetaData(GroovydocHolder.DOC_COMMENT, new Groovydoc(this.documentation, node)); this.methodNodes.add(node); } @@ -356,11 +361,21 @@ public void register() { throw new IllegalArgumentException("Tried to register ObjectMapper for mod " + this.mod + ", but it's not loaded"); Objects.requireNonNull(this.handler, () -> "The ObjectMapper function must no be null"); Objects.requireNonNull(this.returnType, () -> "The ObjectMapper return type must not be null"); - if (this.paramTypes.isEmpty()) this.paramTypes.add(new Class[]{String.class}); + if (this.paramTypes.isEmpty()) this.paramTypes.add(new Class[]{ + String.class + }); if (this.defaultValue == null) this.defaultValue = () -> null; this.documentation = IDocumented.toJavaDoc(this.documentation); - ObjectMapper goh = new ObjectMapper<>(this.name, this.mod, this.handler, this.defaultValue, - this.returnType, this.paramTypes, this.completer, this.documentation, this.textureBinder); + ObjectMapper goh = new ObjectMapper<>( + this.name, + this.mod, + this.handler, + this.defaultValue, + this.returnType, + this.paramTypes, + this.completer, + this.documentation, + this.textureBinder); ObjectMapperManager.registerObjectMapper(this.mod, goh); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java index 6ce1e9ee1..2b277726f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/ObjectMappers.java @@ -29,7 +29,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.*; -import java.util.stream.Collectors; import static com.cleanroommc.groovyscript.mapper.ObjectMapperManager.SPLITTER; import static com.cleanroommc.groovyscript.mapper.ObjectMapperManager.WILDCARD; @@ -150,7 +149,7 @@ public static Result parseBlockState(String arg) { @SuppressWarnings("all") private static Result parseBlockStates(IBlockState defaultState, Iterator iterable) { - for (Iterator it = iterable; it.hasNext(); ) { + for (Iterator it = iterable; it.hasNext();) { String state = it.next(); String[] prop = state.split(EQUALS, 2); IProperty property = defaultState.getBlock().getBlockState().getProperty(prop[0]); diff --git a/src/main/java/com/cleanroommc/groovyscript/mapper/TextureTooltip.java b/src/main/java/com/cleanroommc/groovyscript/mapper/TextureTooltip.java index 20a4e2abe..ca839488f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/mapper/TextureTooltip.java +++ b/src/main/java/com/cleanroommc/groovyscript/mapper/TextureTooltip.java @@ -7,6 +7,7 @@ import java.util.regex.Pattern; public class TextureTooltip { + private static final Pattern embeddingPattern = Pattern.compile("(?>\\$\\{(?\\w+)\\(['\\\"](?[\\w\\s:-]+)['\\\"]\\)})"); private final String content; @@ -54,6 +55,7 @@ public List getEmbeddings() { } public class Embedding { + private final int start; private final int end; private final T context; diff --git a/src/main/java/com/cleanroommc/groovyscript/network/CReload.java b/src/main/java/com/cleanroommc/groovyscript/network/CReload.java index b933490f2..b0ffde051 100644 --- a/src/main/java/com/cleanroommc/groovyscript/network/CReload.java +++ b/src/main/java/com/cleanroommc/groovyscript/network/CReload.java @@ -7,12 +7,10 @@ public class CReload implements IPacket { @Override - public void encode(PacketBuffer buf) { - } + public void encode(PacketBuffer buf) {} @Override - public void decode(PacketBuffer buf) { - } + public void decode(PacketBuffer buf) {} @Override public IPacket executeServer(NetHandlerPlayServer handler) { diff --git a/src/main/java/com/cleanroommc/groovyscript/network/SCopy.java b/src/main/java/com/cleanroommc/groovyscript/network/SCopy.java index 87a7556c6..a552ba5c8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/network/SCopy.java +++ b/src/main/java/com/cleanroommc/groovyscript/network/SCopy.java @@ -13,8 +13,7 @@ public SCopy(String[] text) { this.text = text; } - public SCopy() { - } + public SCopy() {} @Override public void encode(PacketBuffer buf) { diff --git a/src/main/java/com/cleanroommc/groovyscript/network/SReloadScripts.java b/src/main/java/com/cleanroommc/groovyscript/network/SReloadScripts.java index 864d000a8..0a3a7bd19 100644 --- a/src/main/java/com/cleanroommc/groovyscript/network/SReloadScripts.java +++ b/src/main/java/com/cleanroommc/groovyscript/network/SReloadScripts.java @@ -17,8 +17,7 @@ public class SReloadScripts implements IPacket { private boolean changePackmode; private boolean reloadJei; - public SReloadScripts() { - } + public SReloadScripts() {} public SReloadScripts(String packmode, boolean changePackmode, boolean reloadJei) { this.packmode = packmode; diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java index 863133d74..4cf0f20ce 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java @@ -31,20 +31,23 @@ public abstract class AbstractCraftingRecipeBuilder { - @Property(value = "groovyscript.wiki.craftingrecipe.output.value", - comp = @Comp(not = "null"), - priority = 700, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.output.value", + comp = @Comp(not = "null"), + priority = 700, + hierarchy = 20) protected ItemStack output; @Property(value = "groovyscript.wiki.name.value", priority = 100, hierarchy = 20) protected ResourceLocation name; - @Property(value = "groovyscript.wiki.craftingrecipe.recipeFunction.value", - priority = 1500, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.recipeFunction.value", + priority = 1500, + hierarchy = 20) protected Closure recipeFunction; - @Property(value = "groovyscript.wiki.craftingrecipe.recipeAction.value", - priority = 1550, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.recipeAction.value", + priority = 1550, + hierarchy = 20) protected Closure recipeAction; @Property(value = "groovyscript.wiki.craftingrecipe.replace.value", needsOverride = true, hierarchy = 20) protected byte replace; @@ -120,7 +123,9 @@ protected void handleReplace() { } else if (replace == 2) { if (name == null) { GroovyLog.msg("Error replacing Minecraft Crafting recipe") - .add("Name must not be null when replacing by name").error().post(); + .add("Name must not be null when replacing by name") + .error() + .post(); return; } ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, name); @@ -141,8 +146,11 @@ public void validateName() { @GroovyBlacklist @Nullable - protected T validateShape(GroovyLog.Msg msg, List errors, String[] keyBasedMatrix, - Char2ObjectOpenHashMap keyMap, IRecipeCreator recipeCreator) { + protected T validateShape(GroovyLog.Msg msg, + List errors, + String[] keyBasedMatrix, + Char2ObjectOpenHashMap keyMap, + IRecipeCreator recipeCreator) { List ingredients = new ArrayList<>(); if (keyBasedMatrix.length > height) { msg.add("Defined matrix has %d rows, but should only have %d rows", keyBasedMatrix.length, height); @@ -234,22 +242,26 @@ public interface IRecipeCreator { public abstract static class AbstractShaped extends AbstractCraftingRecipeBuilder { - @Property(value = "groovyscript.wiki.craftingrecipe.keyMap.value", - defaultValue = "' ' = IIngredient.EMPTY", - priority = 210, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.keyMap.value", + defaultValue = "' ' = IIngredient.EMPTY", + priority = 210, + hierarchy = 20) protected final Char2ObjectOpenHashMap keyMap = new Char2ObjectOpenHashMap<>(); protected final List errors = new ArrayList<>(); - @Property(value = "groovyscript.wiki.craftingrecipe.mirrored.value", hierarchy = 20) protected boolean mirrored; - @Property(value = "groovyscript.wiki.craftingrecipe.keyBasedMatrix.value", - comp = @Comp(unique = "groovyscript.wiki.craftingrecipe.matrix.required"), - priority = 200, - hierarchy = 20) + @Property(value = "groovyscript.wiki.craftingrecipe.mirrored.value", hierarchy = 20) + protected boolean mirrored; + @Property( + value = "groovyscript.wiki.craftingrecipe.keyBasedMatrix.value", + comp = @Comp(unique = "groovyscript.wiki.craftingrecipe.matrix.required"), + priority = 200, + hierarchy = 20) protected String[] keyBasedMatrix; - @Property(value = "groovyscript.wiki.craftingrecipe.ingredientMatrix.value", - comp = @Comp(gte = 1, lte = 9, unique = "groovyscript.wiki.craftingrecipe.matrix.required"), - priority = 200, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.ingredientMatrix.value", + comp = @Comp(gte = 1, lte = 9, unique = "groovyscript.wiki.craftingrecipe.matrix.required"), + priority = 200, + hierarchy = 20) protected List> ingredientMatrix; public AbstractShaped(int width, int height) { @@ -283,7 +295,9 @@ public AbstractShaped shape(String... matrix) { @RecipeBuilderMethodDescription(field = "keyBasedMatrix") public AbstractShaped row(String row) { if (this.keyBasedMatrix == null) { - this.keyBasedMatrix = new String[]{row}; + this.keyBasedMatrix = new String[]{ + row + }; } else { this.keyBasedMatrix = ArrayUtils.add(this.keyBasedMatrix, row); } @@ -330,10 +344,11 @@ public AbstractShaped shape(List> matrix) { public abstract static class AbstractShapeless extends AbstractCraftingRecipeBuilder { - @Property(value = "groovyscript.wiki.craftingrecipe.ingredients.value", - comp = @Comp(gte = 1, lte = 9), - priority = 250, - hierarchy = 20) + @Property( + value = "groovyscript.wiki.craftingrecipe.ingredients.value", + comp = @Comp(gte = 1, lte = 9), + priority = 250, + hierarchy = 20) protected final List ingredients = new ArrayList<>(); public AbstractShapeless(int width, int height) { diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java index c0e35d62d..9f2060f53 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractReloadableStorage.java @@ -108,5 +108,4 @@ public Collection removeScripted() { protected boolean compareRecipe(R recipe, R recipe2) { return recipe == recipe2; } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java b/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java index d4a8ea460..4c38d3248 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/NamedRegistry.java @@ -50,5 +50,4 @@ public String getName() { 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 32889425f..2a69227eb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/ReloadableRegistryManager.java @@ -77,7 +77,8 @@ public static void init() { public static void onReload() { GroovyScript.reloadRunConfig(false); VanillaModule.INSTANCE.onReload(); - ModSupport.getAllContainers().stream() + ModSupport.getAllContainers() + .stream() .filter(GroovyContainer::isLoaded) .map(GroovyContainer::get) .map(GroovyPropertyContainer::getRegistries) @@ -91,7 +92,8 @@ public static void onReload() { @ApiStatus.Internal public static void afterScriptRun() { - ModSupport.getAllContainers().stream() + ModSupport.getAllContainers() + .stream() .filter(GroovyContainer::isLoaded) .map(GroovyContainer::get) .map(GroovyPropertyContainer::getRegistries) @@ -169,7 +171,8 @@ 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) { + } } } @@ -182,5 +185,4 @@ protected static void reloadForgeRegistries(IForgeRegistry... registries) { private static void unfreezeForgeRegistries() { ((ForgeRegistry) ForgeRegistries.RECIPES).unfreeze(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/StandardListRegistry.java b/src/main/java/com/cleanroommc/groovyscript/registry/StandardListRegistry.java index ab8410183..5bf0ea6a9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/StandardListRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/StandardListRegistry.java @@ -59,5 +59,4 @@ public void removeAll() { public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(getRecipes()).setRemover(this::remove); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java index cc4086c73..ff5d176d9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedRegistry.java @@ -55,8 +55,7 @@ public VirtualizedRegistry(@Nullable Collection aliases) { @Override @GroovyBlacklist @ApiStatus.OverrideOnly - public void afterScriptLoad() { - } + public void afterScriptLoad() {} @GroovyBlacklist protected AbstractReloadableStorage createRecipeStorage() { @@ -104,5 +103,4 @@ protected Collection restoreFromBackup() { protected Collection removeScripted() { return recipeStorage.removeScripted(); } - } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java index fb6229012..627db1bd8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/CompiledScript.java @@ -79,8 +79,10 @@ public JsonObject toJson() { } public static CompiledScript fromJson(JsonObject json, String scriptRoot, String cacheRoot) { - CompiledScript cs = new CompiledScript(json.get("path").getAsString(), JsonHelper.getString(json, null, "name"), - json.get("lm").getAsLong()); + CompiledScript cs = new CompiledScript( + json.get("path").getAsString(), + JsonHelper.getString(json, null, "name"), + json.get("lm").getAsLong()); if (new File(scriptRoot, cs.path).exists()) { if (json.has("inner")) { for (JsonElement element : json.getAsJsonArray("inner")) { @@ -110,15 +112,16 @@ public void deleteCache(String cachePath) { public boolean checkPreprocessors(File basePath) { return this.preprocessors == null || this.preprocessors.isEmpty() || Preprocessor.validatePreprocessor( - new File(basePath, this.path), this.preprocessors); + new File(basePath, this.path), + this.preprocessors); } @Override public String toString() { return new ToStringBuilder(this).append("name", name) - .append("path", path) - .append("innerClasses", innerClasses) - .append("lastEdited", lastEdited) - .toString(); + .append("path", path) + .append("innerClasses", innerClasses) + .append("lastEdited", lastEdited) + .toString(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java index bec2710e0..8fbb15e6e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyLogImpl.java @@ -292,14 +292,7 @@ private List prepareStackTrace(StackTraceElement[] stackTrace) { } private String formatLine(String level, String msg) { - return timeFormat.format(new Date()) + - (FMLCommonHandler.instance().getEffectiveSide().isClient() ? " [CLIENT/" : " [SERVER/") + - level + - "]" + - " [" + - getSource() + - "]: " + - msg; + return timeFormat.format(new Date()) + (FMLCommonHandler.instance().getEffectiveSide().isClient() ? " [CLIENT/" : " [SERVER/") + level + "]" + " [" + getSource() + "]: " + msg; } private String getSource() { @@ -336,7 +329,8 @@ public static class MsgImpl implements GroovyLog.Msg { private final List messages = new ArrayList<>(); private Level level = Level.INFO; private boolean logToMcLog; - @Nullable private Throwable throwable; + @Nullable + private Throwable throwable; private MsgImpl(String msg, Object... data) { this.mainMsg = GroovyLog.format(msg, data); @@ -358,7 +352,7 @@ public Msg add(boolean condition, String msg, Object... args) { if (condition) { if (args != null && args.length > 0) { for (int i = 0; i < args.length; i++) { - if (args[i] instanceof Supplier s) { + if (args[i] instanceof Suppliers) { args[i] = s.get(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java index 2b7365e96..afe459ab3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java @@ -175,16 +175,13 @@ public T runClosure(Closure closure, Object... args) { } @ApiStatus.OverrideOnly - protected void postInitBindings(Binding binding) { - } + protected void postInitBindings(Binding binding) {} @ApiStatus.OverrideOnly - protected void initEngine(GroovyScriptEngine engine, CompilerConfiguration config) { - } + protected void initEngine(GroovyScriptEngine engine, CompilerConfiguration config) {} @ApiStatus.OverrideOnly - protected void preRun() { - } + protected void preRun() {} @ApiStatus.OverrideOnly protected boolean shouldRunFile(File file) { @@ -192,8 +189,7 @@ protected boolean shouldRunFile(File file) { } @ApiStatus.OverrideOnly - protected void postRun() { - } + protected void postRun() {} public abstract Collection getClassFiles(); diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java index b5a0882c5..91b976d1e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/GroovyScriptSandbox.java @@ -27,7 +27,6 @@ import org.apache.groovy.internal.util.UncheckedThrow; import org.codehaus.groovy.control.CompilerConfiguration; import org.codehaus.groovy.control.SourceUnit; -import org.codehaus.groovy.control.customizers.ImportCustomizer; import org.codehaus.groovy.runtime.InvokerInvocationException; import org.codehaus.groovy.vmplugin.VMPlugin; import org.jetbrains.annotations.ApiStatus; @@ -35,7 +34,6 @@ import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -75,36 +73,37 @@ public GroovyScriptSandbox() { registerBinding("EventManager", GroovyEventManager.INSTANCE); getImportCustomizer().addStaticStars(GroovyHelper.class.getName(), MathHelper.class.getName()); - getImportCustomizer().addImports("net.minecraft.world.World", - "net.minecraft.block.state.IBlockState", - "net.minecraft.block.Block", - "net.minecraft.block.SoundType", - "net.minecraft.enchantment.Enchantment", - "net.minecraft.entity.Entity", - "net.minecraft.entity.player.EntityPlayer", - "net.minecraft.init.Biomes", - "net.minecraft.init.Blocks", - "net.minecraft.init.Enchantments", - "net.minecraft.init.Items", - "net.minecraft.init.MobEffects", - "net.minecraft.init.PotionTypes", - "net.minecraft.init.SoundEvents", - "net.minecraft.item.EnumRarity", - "net.minecraft.item.Item", - "net.minecraft.item.ItemStack", - "net.minecraft.nbt.NBTTagCompound", - "net.minecraft.nbt.NBTTagList", - "net.minecraft.tileentity.TileEntity", - "net.minecraft.util.math.BlockPos", - "net.minecraft.util.DamageSource", - "net.minecraft.util.EnumHand", - "net.minecraft.util.EnumHandSide", - "net.minecraft.util.EnumFacing", - "net.minecraft.util.ResourceLocation", - "net.minecraftforge.fml.common.eventhandler.EventPriority", - "com.cleanroommc.groovyscript.event.EventBusType", - "net.minecraftforge.fml.relauncher.Side", - "net.minecraftforge.fml.relauncher.SideOnly"); + getImportCustomizer().addImports( + "net.minecraft.world.World", + "net.minecraft.block.state.IBlockState", + "net.minecraft.block.Block", + "net.minecraft.block.SoundType", + "net.minecraft.enchantment.Enchantment", + "net.minecraft.entity.Entity", + "net.minecraft.entity.player.EntityPlayer", + "net.minecraft.init.Biomes", + "net.minecraft.init.Blocks", + "net.minecraft.init.Enchantments", + "net.minecraft.init.Items", + "net.minecraft.init.MobEffects", + "net.minecraft.init.PotionTypes", + "net.minecraft.init.SoundEvents", + "net.minecraft.item.EnumRarity", + "net.minecraft.item.Item", + "net.minecraft.item.ItemStack", + "net.minecraft.nbt.NBTTagCompound", + "net.minecraft.nbt.NBTTagList", + "net.minecraft.tileentity.TileEntity", + "net.minecraft.util.math.BlockPos", + "net.minecraft.util.DamageSource", + "net.minecraft.util.EnumHand", + "net.minecraft.util.EnumHandSide", + "net.minecraft.util.EnumFacing", + "net.minecraft.util.ResourceLocation", + "net.minecraftforge.fml.common.eventhandler.EventPriority", + "com.cleanroommc.groovyscript.event.EventBusType", + "net.minecraftforge.fml.relauncher.Side", + "net.minecraftforge.fml.relauncher.SideOnly"); this.storedExceptions = new Object2ObjectOpenHashMap<>(); readIndex(); } @@ -238,9 +237,7 @@ 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; } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java index 780570e9e..04bcc1f34 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/Preprocessor.java @@ -150,8 +150,9 @@ private static boolean checkSide(File file, String[] sides) { private static boolean checkPackmode(File file, String[] modes) { for (String mode : modes) { if (!Packmode.isValidPackmode(mode)) { - List valid = GroovyScript.getRunConfig().isIntegratePackmodeMod() ? PackModeAPI.getInstance().getPackModes() - : GroovyScript.getRunConfig().getPackmodeList(); + List valid = GroovyScript.getRunConfig().isIntegratePackmodeMod() + ? PackModeAPI.getInstance().getPackModes() + : GroovyScript.getRunConfig().getPackmodeList(); 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; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java index 99bde5ff7..bc3d5173b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java @@ -10,7 +10,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import net.minecraft.util.ResourceLocation; @@ -20,14 +19,9 @@ import org.jetbrains.annotations.ApiStatus; import java.io.File; -import java.io.IOException; -import java.nio.file.FileVisitOption; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; -import java.util.stream.Stream; public class RunConfig { @@ -52,8 +46,9 @@ public static JsonObject createDefaultJson() { JsonObject packmode = new JsonObject(); packmode.add("values", new JsonArray()); packmode.addProperty("default", ""); - packmode.addProperty("_comment", - "By default the packmode is not synced with the packmode mod. You can enable integration, but you can no longer change packmode on the fly."); + packmode.addProperty( + "_comment", + "By default the packmode is not synced with the packmode mod. You can enable integration, but you can no longer change packmode on the fly."); packmode.addProperty("integratePackmodeMod", false); json.add("packmode", packmode); return json; @@ -153,9 +148,9 @@ public void reload(JsonObject json, boolean init) { List> pathsList = new ArrayList<>(); GroovyLog.Msg errorMsg = GroovyLog.msg("Fatal while parsing runConfig.json") - .add("Files should NOT be ran in multiple loaders!") - .logToMc() - .fatal(); + .add("Files should NOT be ran in multiple loaders!") + .logToMc() + .fatal(); for (Map.Entry entry : jsonLoaders.entrySet()) { JsonArray loader = (JsonArray) entry.getValue(); @@ -219,11 +214,11 @@ public String getPackName() { public String getPackId() { if (this.invalidPackId && !this.warnedAboutInvalidPackId) { GroovyLog.msg("Fatal error while trying to use the pack id") - .add("specified pack id is invalid or empty ('{}')", this.packId) - .add("pack id must only contain lower case letters and underscores") - .add("see https://cleanroommc.com/groovy-script/getting_started/run_config for more info") - .fatal() - .post(); + .add("specified pack id is invalid or empty ('{}')", this.packId) + .add("pack id must only contain lower case letters and underscores") + .add("see https://cleanroommc.com/groovy-script/getting_started/run_config for more info") + .fatal() + .post(); this.warnedAboutInvalidPackId = true; } return packId; diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java index ad72a9c94..2710a9670 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/SandboxData.java @@ -23,7 +23,9 @@ */ public class SandboxData { - public static final String[] GROOVY_SUFFIXES = {".groovy", ".gvy", ".gy", ".gsh"}; + public static final String[] GROOVY_SUFFIXES = { + ".groovy", ".gvy", ".gy", ".gsh" + }; private static File minecraftHome; private static File scriptPath; private static File runConfigFile; @@ -62,7 +64,9 @@ public static void initialize(File minecraftHome, Logger log) { resourcesFile = new File(scriptPath, "assets"); try { rootUrl = scriptPath.toURI().toURL(); - rootUrls = new URL[]{rootUrl}; + rootUrls = new URL[]{ + rootUrl + }; } catch (MalformedURLException e) { throw new IllegalStateException("Failed to create URL from script path " + scriptPath); } @@ -145,17 +149,19 @@ static Collection getSortedFilesOf(File root, Collection paths) { } int pathSize = path.split(separator).length; try (Stream stream = Files.walk(rootFile.toPath())) { - stream.filter(path1 -> isGroovyFile(path1.toString())).map(Path::toFile) - //.filter(Preprocessor::validatePreprocessors) - .sorted(Comparator.comparing(File::getPath)).forEach(file -> { - if (files.containsKey(file)) { - if (pathSize > files.getInt(file)) { - files.put(file, pathSize); - } - } else { - files.put(file, pathSize); - } - }); + stream.filter(path1 -> isGroovyFile(path1.toString())) + .map(Path::toFile) + //.filter(Preprocessor::validatePreprocessors) + .sorted(Comparator.comparing(File::getPath)) + .forEach(file -> { + if (files.containsKey(file)) { + if (pathSize > files.getInt(file)) { + files.put(file, pathSize); + } + } else { + files.put(file, pathSize); + } + }); } catch (IOException e) { throw new RuntimeException(e); } 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 3f318840d..abdf4ca59 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/expand/ExpansionHelper.java @@ -150,6 +150,7 @@ private static void mixinMethod(ExpandoMetaClass self, CachedMethod method, Mixi metaMethod = new NewInstanceMetaMethod(method); else metaMethod = new NewInstanceMetaMethod(method) { + @Override public CachedClass getDeclaringClass() { return ReflectionCache.getCachedClass(self.getTheClass()); @@ -173,13 +174,21 @@ public static void mixinConstProperty(Class self, String name, T obj, mixinProperty(self, name, type, s -> obj, null, hidden); } - public static void mixinProperty(Class self, String name, Class type, - @Nullable Supplier getter, @Nullable Consumer setter, boolean hidden) { + public static void mixinProperty(Class self, + String name, + Class type, + @Nullable Supplier getter, + @Nullable Consumer setter, + boolean hidden) { mixinProperty(self, name, type, getter != null ? s -> getter.get() : null, setter != null ? (s, t) -> setter.accept(t) : null, hidden); } - public static void mixinProperty(Class self, String name, Class type, - @Nullable Function getter, @Nullable BiConsumer setter, boolean hidden) { + 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!"); @@ -187,10 +196,10 @@ public static void mixinProperty(Class self, String name, Class typ String upperName = name; if (!Character.isDigit(name.charAt(0))) upperName = BeanUtils.capitalize(name); if (getter == null) { - getter = so -> {throw new GroovyRuntimeException("Property '" + name + "' in " + self.getName() + " is writable, but not readable!");}; + getter = so -> { throw new GroovyRuntimeException("Property '" + name + "' in " + self.getName() + " is writable, but not readable!"); }; } if (setter == null) { - setter = (so, t) -> {throw new GroovyRuntimeException("Property '" + name + "' in " + self.getName() + " is readable, but not writable!");}; + setter = (so, t) -> { throw new GroovyRuntimeException("Property '" + name + "' in " + self.getName() + " is readable, but not writable!"); }; } MetaMethod g = new Getter<>("get" + upperName, type, self, getter); @@ -202,18 +211,14 @@ public static void mixinProperty(Class self, String name, Class typ private static boolean isValid(CachedMethod method) { final int mod = method.getModifiers(); - return Modifier.isPublic(mod) && !Modifier.isAbstract(mod) && !method.isSynthetic() && - method.getAnnotation(Internal.class) == null && - method.getAnnotation(GroovyBlacklist.class) == null; + return Modifier.isPublic(mod) && !Modifier.isAbstract(mod) && !method.isSynthetic() && method.getAnnotation(Internal.class) == null && method.getAnnotation(GroovyBlacklist.class) == null; } private static boolean isValid(CachedField cachedField) { if (cachedField == null) return true; final int mod = cachedField.getModifiers(); Field field = cachedField.getCachedField(); - return Modifier.isPublic(mod) && !field.isSynthetic() && - !field.isAnnotationPresent(Internal.class) && - !field.isAnnotationPresent(GroovyBlacklist.class); + return Modifier.isPublic(mod) && !field.isSynthetic() && !field.isAnnotationPresent(Internal.class) && !field.isAnnotationPresent(GroovyBlacklist.class); } /** diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/BlackListedMetaClass.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/BlackListedMetaClass.java index e1534ce5d..a2e3aae63 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/BlackListedMetaClass.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/BlackListedMetaClass.java @@ -1,7 +1,6 @@ package com.cleanroommc.groovyscript.sandbox.meta; import com.cleanroommc.groovyscript.sandbox.RunConfig; - import com.cleanroommc.groovyscript.sandbox.security.SandboxSecurityException; import groovy.lang.*; import org.codehaus.groovy.ast.ClassNode; @@ -64,8 +63,7 @@ public void setAttribute(Class sender, Object receiver, String messageName, Obje } @Override - public void initialize() { - } + public void initialize() {} @Override public List getProperties() { @@ -198,7 +196,6 @@ public ClassNode getClassNode() { throw new GroovyRuntimeException("Exception thrown parsing: " + groovyFile + ". Reason: " + e, e); } } - } return classNode; } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/GrSMetaClassCreationHandle.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/GrSMetaClassCreationHandle.java index 955ef64a0..e609eb939 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/GrSMetaClassCreationHandle.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/GrSMetaClassCreationHandle.java @@ -13,8 +13,7 @@ public class GrSMetaClassCreationHandle extends MetaClassRegistry.MetaClassCreat public static final GrSMetaClassCreationHandle INSTANCE = new GrSMetaClassCreationHandle(); - private GrSMetaClassCreationHandle() { - } + private GrSMetaClassCreationHandle() {} @Override protected MetaClass createNormalMetaClass(Class theClass, MetaClassRegistry registry) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/Setter.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/Setter.java index 81fbe92a3..e2c9f2a73 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/Setter.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/meta/Setter.java @@ -15,11 +15,15 @@ public class Setter extends MetaMethod implements Hidden { private final BiConsumer setter; public Setter(String name, Class paramType, Class owner, BiConsumer setter) { - super(new Class[]{paramType}); + super(new Class[]{ + paramType + }); this.name = name; this.owner = owner; this.setter = setter; - setParametersTypes(new CachedClass[]{ReflectionCache.getCachedClass(paramType)}); + setParametersTypes(new CachedClass[]{ + ReflectionCache.getCachedClass(paramType) + }); } @Override 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 9e401f9b9..9c5bb722c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/GroovySecurityManager.java @@ -130,10 +130,7 @@ public boolean isValid(Field field) { } public boolean isValid(ClassNode classNode) { - return this.whiteListedClasses.contains(classNode.name) || - (!bannedClasses.contains(classNode.name) && - !hasBlacklistAnnotation(classNode.visibleAnnotations) && - isValidPackage(classNode.name)); + return this.whiteListedClasses.contains(classNode.name) || (!bannedClasses.contains(classNode.name) && !hasBlacklistAnnotation(classNode.visibleAnnotations) && isValidPackage(classNode.name)); } public boolean isValid(Class clazz) { diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/SandboxSecurityException.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/SandboxSecurityException.java index d8db4981d..5b3481635 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/security/SandboxSecurityException.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/security/SandboxSecurityException.java @@ -11,4 +11,4 @@ public SandboxSecurityException(String msg) { public static SandboxSecurityException format(String msg) { return new SandboxSecurityException(msg); } -} \ No newline at end of file +} 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 a57d132f5..995dff1d5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyCodeFactory.java @@ -25,8 +25,7 @@ public class GroovyCodeFactory { public static final String MC_CLASS = "net.minecraft."; public static final boolean spongeForgeLoaded = Loader.isModLoaded("spongeforge"); - private GroovyCodeFactory() { - } + private GroovyCodeFactory() {} public static boolean shouldRemap(CachedClass cachedClass) { return !spongeForgeLoaded && !FMLLaunchHandler.isDeobfuscatedEnvironment() && cachedClass.getName().startsWith(MC_CLASS); @@ -36,10 +35,10 @@ public static PrivilegedAction makeFieldsHook(CachedClass cachedC return () -> { final boolean remap = shouldRemap(cachedClass); return Arrays.stream(cachedClass.getTheClass().getDeclaredFields()) - .filter(f -> ReflectionUtils.checkCanSetAccessible(f, CachedClass.class)) - .filter(GroovySecurityManager.INSTANCE::isValid) - .map(f -> makeField(cachedClass, f, remap)) - .toArray(CachedField[]::new); + .filter(f -> ReflectionUtils.checkCanSetAccessible(f, CachedClass.class)) + .filter(GroovySecurityManager.INSTANCE::isValid) + .map(f -> makeField(cachedClass, f, remap)) + .toArray(CachedField[]::new); }; } @@ -55,11 +54,11 @@ private static CachedField makeField(CachedClass cachedClass, Field field, boole public static PrivilegedAction makeConstructorsHook(CachedClass cachedClass) { return () -> Arrays.stream(cachedClass.getTheClass().getDeclaredConstructors()) - .filter(c -> !c.isSynthetic()) // GROOVY-9245: exclude inner class ctors - .filter(c -> ReflectionUtils.checkCanSetAccessible(c, CachedClass.class)) - .filter(c -> !c.isAnnotationPresent(GroovyBlacklist.class)) - .map(c -> new CachedConstructor(cachedClass, c)) - .toArray(CachedConstructor[]::new); + .filter(c -> !c.isSynthetic()) // GROOVY-9245: exclude inner class ctors + .filter(c -> ReflectionUtils.checkCanSetAccessible(c, CachedClass.class)) + .filter(c -> !c.isAnnotationPresent(GroovyBlacklist.class)) + .map(c -> new CachedConstructor(cachedClass, c)) + .toArray(CachedConstructor[]::new); } public static PrivilegedAction makeMethodsHook(CachedClass cachedClass) { @@ -67,12 +66,12 @@ public static PrivilegedAction makeMethodsHook(CachedClass cache try { final boolean remap = shouldRemap(cachedClass); return Arrays.stream(cachedClass.getTheClass().getDeclaredMethods()) - .filter(m -> m.getName().indexOf('+') < 0) // no synthetic JDK 5+ methods - .filter(m -> ReflectionUtils.checkCanSetAccessible(m, CachedClass.class)) - .filter(GroovySecurityManager.INSTANCE::isValid) - .map(m -> makeMethod(cachedClass, m, remap)) - .distinct() - .toArray(CachedMethod[]::new); + .filter(m -> m.getName().indexOf('+') < 0) // no synthetic JDK 5+ methods + .filter(m -> ReflectionUtils.checkCanSetAccessible(m, CachedClass.class)) + .filter(GroovySecurityManager.INSTANCE::isValid) + .map(m -> makeMethod(cachedClass, m, remap)) + .distinct() + .toArray(CachedMethod[]::new); } catch (LinkageError e) { return CachedMethod.EMPTY_ARRAY; } @@ -110,8 +109,13 @@ public static void remapOverrides(ClassNode classNode) { * Copies a method node with a new name */ private static MethodNode copyRemappedMethodNode(String name, MethodNode original) { - MethodNode copy = new MethodNode(name, original.getModifiers(), original.getReturnType(), original.getParameters(), - original.getExceptions(), original.getCode()); + MethodNode copy = new MethodNode( + name, + original.getModifiers(), + original.getReturnType(), + original.getParameters(), + original.getExceptions(), + original.getCode()); copy.setAnnotationDefault(original.hasDefaultValue()); copy.setColumnNumber(original.getColumnNumber()); copy.setDeclaringClass(original.getDeclaringClass()); 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 cc7e0e201..a5b9dc234 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,7 @@ 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); } diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptEarlyCompiler.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptEarlyCompiler.java index 040d31c6f..8c6c797d3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptEarlyCompiler.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptEarlyCompiler.java @@ -47,9 +47,10 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod if (parts.length > 2) { prop = new PropertyExpression(prop, parts[2]); } - Expression expr = new DeclarationExpression(new VariableExpression(imp.getAlias()), - Token.newSymbol(Types.ASSIGN, imp.getLineNumber(), 5 + parts[1].length()), - prop); + Expression expr = new DeclarationExpression( + new VariableExpression(imp.getAlias()), + Token.newSymbol(Types.ASSIGN, imp.getLineNumber(), 5 + parts[1].length()), + prop); scriptStatement.getStatements().add(0, new ExpressionStatement(expr)); return true; } 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 cafbd923a..7dad2460b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/transformer/GroovyScriptTransformer.java @@ -106,8 +106,7 @@ private Expression transformMethodCall(MethodCallExpression mce) { List suggestions = conflicts.stream() .map(goh -> goh.getMod() == null ? goh.getName() : "mods." + goh.getMod().getModId() + "." + goh.getName()) .collect(Collectors.toList()); - String msg = GroovyLog.format("Can't infer ObjectMapper from name {}, since one is added by {} mods. " + - "Please choose one of the following: {}", mce.getMethodAsString(), conflicts.size(), suggestions); + String msg = GroovyLog.format("Can't infer ObjectMapper from name {}, since one is added by {} mods. " + "Please choose one of the following: {}", mce.getMethodAsString(), conflicts.size(), suggestions); source.addError(new SyntaxException(msg, mce)); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java index f453ae3c7..c21fd7232 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptCompilationUnitFactory.java @@ -61,7 +61,9 @@ public GroovyLSCompilationUnit create(Path workspaceRoot, @Nullable URI context) removeSources(unit, changedUris); // add open classes - languageServerContext.getFileContentsTracker().getOpenURIs().stream() + languageServerContext.getFileContentsTracker() + .getOpenURIs() + .stream() .filter(uri -> { Path openPath = Paths.get(uri); return openPath.normalize().startsWith(workspaceRoot.normalize()); @@ -95,7 +97,9 @@ protected boolean isInClassesContext(URI uri) { } protected Stream getAllClasses() { - return LoadStage.getLoadStages().stream().map(LoadStage::getName) + return LoadStage.getLoadStages() + .stream() + .map(LoadStage::getName) .flatMap(loader -> GroovyScript.getRunConfig().getClassFiles(this.root, loader).stream()) .map(File::toPath) .map(path -> GroovyScript.getScriptFile().toPath().resolve(path)); diff --git a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java index 1e448516d..f555ce26f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/GroovyScriptDocumentationProvider.java @@ -23,11 +23,13 @@ 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(ClassHelper.makeCached(IScriptReloadable.class))) { + if (node instanceof MethodNode methodNode && methodNode.getDeclaringClass().implementsInterface(ClassHelper.makeCached(IScriptReloadable.class))) { ModSupport.getAllContainers().stream().filter(IGroovyContainer::isLoaded).map(groovyContainer -> { - var methodRegistry = groovyContainer.get().getRegistries().stream().filter( - registry -> registry.getClass().equals(methodNode.getDeclaringClass().getTypeClass())).findFirst(); + var methodRegistry = groovyContainer.get() + .getRegistries() + .stream() + .filter(registry -> registry.getClass().equals(methodNode.getDeclaringClass().getTypeClass())) + .findFirst(); if (methodRegistry.isPresent()) { var method = GroovyReflectionUtils.resolveMethodFromMethodNode(methodNode, context); @@ -46,9 +48,6 @@ public class GroovyScriptDocumentationProvider implements IDocumentationProvider @Override public @Nullable String getSortText(AnnotatedNode node, ASTContext context) { - return node instanceof MethodNode methodNode && - !methodNode.getDeclaringClass().getAnnotations(ClassHelper.makeCached(RegistryDescription.class)).isEmpty() && - !methodNode.getAnnotations(ClassHelper.makeCached(MethodDescription.class)).isEmpty() ? - "!!!" + methodNode.getName() : null; + return node instanceof MethodNode methodNode && !methodNode.getDeclaringClass().getAnnotations(ClassHelper.makeCached(RegistryDescription.class)).isEmpty() && !methodNode.getAnnotations(ClassHelper.makeCached(MethodDescription.class)).isEmpty() ? "!!!" + methodNode.getName() : null; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/server/features/textureDecoration/TextureDecorationProvider.java b/src/main/java/com/cleanroommc/groovyscript/server/features/textureDecoration/TextureDecorationProvider.java index 0a509cc6f..b4130fda7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/server/features/textureDecoration/TextureDecorationProvider.java +++ b/src/main/java/com/cleanroommc/groovyscript/server/features/textureDecoration/TextureDecorationProvider.java @@ -69,9 +69,7 @@ public CompletableFuture> provideTextureDecor call = method; } } else continue; - if (mappers.contains(call) || - !(call.getArguments() instanceof ArgumentListExpression args) || - args.getExpressions().isEmpty()) continue; + if (mappers.contains(call) || !(call.getArguments() instanceof ArgumentListExpression args) || args.getExpressions().isEmpty()) continue; ObjectMapper mapper; try { mapper = GroovyASTUtils.getMapperOfNode(call, astContext); @@ -144,7 +142,8 @@ private String computeTextureName(String name, List expressions) { return DigestUtils.sha1Hex(sb.toString()); } - private void render(List queueDeco, List queueRange, + private void render(List queueDeco, + List queueRange, List decorationInformations) { var framebuffer = GL30.glGenFramebuffers(); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer); diff --git a/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java b/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java index fb6db21d5..666c25b25 100644 --- a/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java +++ b/src/main/java/net/prominic/groovyls/GroovyLanguageServer.java @@ -80,8 +80,7 @@ public CompletableFuture shutdown() { } @Override - public void exit() { - } + public void exit() {} @Override public TextDocumentService getTextDocumentService() { @@ -94,9 +93,7 @@ public WorkspaceService getWorkspaceService() { } @Override - public void setTrace(SetTraceParams params) { - - } + public void setTrace(SetTraceParams params) {} @Override public void connect(LanguageClient client) { diff --git a/src/main/java/net/prominic/groovyls/GroovyServices.java b/src/main/java/net/prominic/groovyls/GroovyServices.java index 99e6b7231..22662013f 100644 --- a/src/main/java/net/prominic/groovyls/GroovyServices.java +++ b/src/main/java/net/prominic/groovyls/GroovyServices.java @@ -124,8 +124,11 @@ public void didSave(DidSaveTextDocumentParams params) { @Override public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) { - Set urisWithChanges = params.getChanges().stream().map(fileEvent -> FileUtil.fixUri(fileEvent.getUri())).collect( - Collectors.toSet()); + Set urisWithChanges = params.getChanges() + .stream() + .map(fileEvent -> FileUtil.fixUri(fileEvent.getUri())) + .collect( + Collectors.toSet()); for (URI uri : urisWithChanges) { var unit = compilationUnitFactory.create(workspaceRoot, uri); @@ -201,8 +204,9 @@ public CompletableFuture, CompletionList>> completio } else { changeEvent = new TextDocumentContentChangeEvent(new Range(position, position), "a"); } - DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams(versionedTextDocument, - Collections.singletonList(changeEvent)); + DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams( + versionedTextDocument, + Collections.singletonList(changeEvent)); // if the offset node is null, there is probably a syntax error. // a completion request is usually triggered by the . character, and // if there is no property name after the dot, it will cause a syntax @@ -222,8 +226,9 @@ public CompletableFuture, CompletionList>> completio if (originalSource != null) { VersionedTextDocumentIdentifier versionedTextDocument = new VersionedTextDocumentIdentifier(textDocument.getUri(), 1); TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent(null, originalSource); - DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams(versionedTextDocument, - Collections.singletonList(changeEvent)); + DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams( + versionedTextDocument, + Collections.singletonList(changeEvent)); didChange(didChangeParams); } } @@ -257,8 +262,9 @@ public CompletableFuture signatureHelp(SignatureHelpParams params originalSource = languageServerContext.getFileContentsTracker().getContents(uri); VersionedTextDocumentIdentifier versionedTextDocument = new VersionedTextDocumentIdentifier(textDocument.getUri(), 1); TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent(new Range(position, position), ")"); - DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams(versionedTextDocument, - Collections.singletonList(changeEvent)); + DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams( + versionedTextDocument, + Collections.singletonList(changeEvent)); // if the offset node is null, there is probably a syntax error. // a signature help request is usually triggered by the ( character, // and if there is no matching ), it will cause a syntax error. @@ -277,8 +283,9 @@ public CompletableFuture signatureHelp(SignatureHelpParams params if (originalSource != null) { VersionedTextDocumentIdentifier versionedTextDocument = new VersionedTextDocumentIdentifier(textDocument.getUri(), 1); TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent(null, originalSource); - DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams(versionedTextDocument, - Collections.singletonList(changeEvent)); + DidChangeTextDocumentParams didChangeParams = new DidChangeTextDocumentParams( + versionedTextDocument, + Collections.singletonList(changeEvent)); didChange(didChangeParams); } } @@ -319,7 +326,7 @@ public CompletableFuture>> docume @Override public CompletableFuture, List>> symbol( - WorkspaceSymbolParams params) { + WorkspaceSymbolParams params) { var unit = compilationUnitFactory.create(workspaceRoot, null); var visitor = compileAndVisitAST(unit, null); @@ -335,8 +342,10 @@ public CompletableFuture rename(RenameParams params) { var visitor = compileAndVisitAST(unit, uri); - RenameProvider provider = new RenameProvider(uri, new ASTContext(visitor, languageServerContext), - languageServerContext.getFileContentsTracker()); + RenameProvider provider = new RenameProvider( + uri, + new ASTContext(visitor, languageServerContext), + languageServerContext.getFileContentsTracker()); return provider.provideRename(params); } @@ -373,9 +382,14 @@ private Iterable handleErrorCollector(ErrorCollector c diagnostic.setMessage(cause.getOriginalMessage()); diagnostic.setSeverity(DiagnosticSeverity.Error); // TODO source location URI uri = Paths.get(cause.getSourceLocator()).toUri(); - diagnosticsByFile.computeIfAbsent(uri, (key) -> new PublishDiagnosticsParams(key.toString(), - new ArrayList<>())).getDiagnostics().add( - diagnostic); + diagnosticsByFile.computeIfAbsent( + uri, + (key) -> new PublishDiagnosticsParams( + key.toString(), + new ArrayList<>())) + .getDiagnostics() + .add( + diagnostic); } } } 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 bf1d2f58b..0b70bb946 100644 --- a/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java +++ b/src/main/java/net/prominic/groovyls/compiler/control/GroovyLSCompilationUnit.java @@ -39,12 +39,17 @@ public class GroovyLSCompilationUnit extends CompilationUnit { private final ILanguageServerContext languageServerContext; - @Nullable private ASTNodeVisitor visitor; + @Nullable + private ASTNodeVisitor visitor; - @Nullable private URI previousContext; + @Nullable + private URI previousContext; - public GroovyLSCompilationUnit(CompilerConfiguration config, CodeSource security, GroovyClassLoader loader, - ILanguageServerContext languageServerContext) { + public GroovyLSCompilationUnit( + CompilerConfiguration config, + CodeSource security, + GroovyClassLoader loader, + ILanguageServerContext languageServerContext) { super(config, security, loader); this.languageServerContext = languageServerContext; this.errorCollector = new LanguageServerErrorCollector(config); @@ -57,8 +62,12 @@ public void setErrorCollector(LanguageServerErrorCollector errorCollector) { public void removeSources(Collection sourceUnitsToRemove) { for (SourceUnit sourceUnit : sourceUnitsToRemove) { if (sourceUnit.getAST() != null) { - List sourceUnitClassNames = sourceUnit.getAST().getClasses().stream().map(classNode -> classNode.getName()).collect( - Collectors.toList()); + List sourceUnitClassNames = sourceUnit.getAST() + .getClasses() + .stream() + .map(classNode -> classNode.getName()) + .collect( + Collectors.toList()); final List generatedClasses = getClasses(); generatedClasses.removeIf(groovyClass -> sourceUnitClassNames.contains(groovyClass.getName())); } 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 8f6a06ba8..882af3e7a 100644 --- a/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java +++ b/src/main/java/net/prominic/groovyls/compiler/documentation/DocumentationFactory.java @@ -45,8 +45,7 @@ public DocumentationFactory(IDocumentationProvider... providers) { } } if (node instanceof MethodNode mn) { - if (node.getDeclaringClass().isDerivedFrom(ClassHelper.makeCached(GroovyPropertyContainer.class)) || - node.getDeclaringClass().isDerivedFrom(ClassHelper.makeCached(ModSupport.class))) { + if (node.getDeclaringClass().isDerivedFrom(ClassHelper.makeCached(GroovyPropertyContainer.class)) || node.getDeclaringClass().isDerivedFrom(ClassHelper.makeCached(ModSupport.class))) { return "z" + mn.getName(); } if (this.lastSortedMethods.contains(mn.getName())) return "zz" + mn.getName(); diff --git a/src/main/java/net/prominic/groovyls/compiler/documentation/IDocumentationProvider.java b/src/main/java/net/prominic/groovyls/compiler/documentation/IDocumentationProvider.java index ca8aaef0d..fd3e643a0 100644 --- a/src/main/java/net/prominic/groovyls/compiler/documentation/IDocumentationProvider.java +++ b/src/main/java/net/prominic/groovyls/compiler/documentation/IDocumentationProvider.java @@ -6,7 +6,9 @@ public interface IDocumentationProvider { - @Nullable String getDocumentation(AnnotatedNode node, ASTContext context); + @Nullable + String getDocumentation(AnnotatedNode node, ASTContext context); - @Nullable String getSortText(AnnotatedNode node, ASTContext context); + @Nullable + String getSortText(AnnotatedNode node, ASTContext context); } 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 410e54c52..73181ed01 100644 --- a/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java +++ b/src/main/java/net/prominic/groovyls/compiler/util/GroovyASTUtils.java @@ -203,21 +203,28 @@ public static FieldNode getFieldFromExpression(PropertyExpression node, ASTConte public static List getFieldsForLeftSideOfPropertyExpression(ClassNode classNode, Expression expr, ASTContext context) { boolean statics = expr instanceof ClassExpression; - return collectFields(classNode, new ArrayList<>(), - node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); + return collectFields( + classNode, + new ArrayList<>(), + node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); } - public static List getPropertiesForLeftSideOfPropertyExpression(ClassNode classNode, Expression expr, + public static List getPropertiesForLeftSideOfPropertyExpression(ClassNode classNode, + Expression expr, ASTContext context) { boolean statics = expr instanceof ClassExpression; - return collectProperties(classNode, new ArrayList<>(), - node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); + return collectProperties( + classNode, + new ArrayList<>(), + node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); } public static List getMethodsForLeftSideOfPropertyExpression(ClassNode classNode, Expression expr, ASTContext context) { boolean statics = expr instanceof ClassExpression; - return collectMethods(classNode, new ArrayList<>(), - node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); + return collectMethods( + classNode, + new ArrayList<>(), + node -> statics == node.isStatic() && (node.getModifiers() & HIDDEN_MARKER) == 0); } public static List collectFields(ClassNode classNode, List nodes, Predicate test) { @@ -329,9 +336,9 @@ public static List getMethodOverloadsFromCallExpression(MethodCall n List mn = new ArrayList<>(); if (methodCallExpr.isImplicitThis()) { Object o = context.getLanguageServerContext().getSandbox().getBindings().get(node.getMethodAsString()); - if (o instanceof ObjectMapper goh) { + if (o instanceof ObjectMappergoh) { mn.addAll(goh.getMethodNodes()); - } else if (o instanceof Closure closure) { + } else if (o instanceof Closureclosure) { mn.add(methodNodeOfClosure(node.getMethodAsString(), closure)); } } @@ -345,8 +352,11 @@ public static List getMethodOverloadsFromCallExpression(MethodCall n ClassNode constructorType = constructorCallExpr.getType(); if (constructorType != null) { fillClassNode(constructorType); - return constructorType.getDeclaredConstructors().stream().map(constructor -> (MethodNode) constructor).collect( - Collectors.toList()); + return constructorType.getDeclaredConstructors() + .stream() + .map(constructor -> (MethodNode) constructor) + .collect( + Collectors.toList()); } } else if (node instanceof StaticMethodCallExpression staticMethodCallExpression) { var ownerType = staticMethodCallExpression.getOwnerType(); @@ -453,11 +463,17 @@ public static Range findAddImportRange(URI uri, ASTNode offsetNode, ASTContext c } public static MethodNode methodNodeOfClosure(String name, Closure closure) { - Class declarer = closure.getThisObject() == null ? (closure.getOwner() == null ? Object.class : closure.getOwner().getClass()) : - closure.getThisObject().getClass(); - MethodNode method = new MethodNode(name, Modifier.PUBLIC, ClassHelper.OBJECT_TYPE, - ArrayUtils.map(closure.getParameterTypes(), c -> new Parameter(ClassHelper.makeCached(c), ""), - new Parameter[closure.getParameterTypes().length]), null, null); + Class declarer = closure.getThisObject() == null ? (closure.getOwner() == null ? Object.class : closure.getOwner().getClass()) : closure.getThisObject().getClass(); + MethodNode method = new MethodNode( + name, + Modifier.PUBLIC, + ClassHelper.OBJECT_TYPE, + ArrayUtils.map( + closure.getParameterTypes(), + c -> new Parameter(ClassHelper.makeCached(c), ""), + new Parameter[closure.getParameterTypes().length]), + null, + null); method.setDeclaringClass(ClassHelper.makeCached(declarer)); return method; } @@ -487,8 +503,10 @@ public static void fillClassNode(ClassNode classNode) { if (mm.isPrivate()) continue; int m = mm.getModifiers(); if (mm instanceof Hidden hidden && hidden.isHidden()) m |= HIDDEN_MARKER; - Parameter[] params = ArrayUtils.map(mm.getNativeParameterTypes(), c -> new Parameter(ClassHelper.makeCached(c), ""), - new Parameter[mm.getNativeParameterTypes().length]); + Parameter[] params = ArrayUtils.map( + mm.getNativeParameterTypes(), + c -> new Parameter(ClassHelper.makeCached(c), ""), + new Parameter[mm.getNativeParameterTypes().length]); MethodNode node = new MethodNode(mm.getName(), m, ClassHelper.makeCached(mm.getReturnType()), params, null, null); node.setDeclaringClass(classNode); if (mm instanceof IDocumented documented && documented.getDocumentation() != null) { diff --git a/src/main/java/net/prominic/groovyls/compiler/util/GroovyReflectionUtils.java b/src/main/java/net/prominic/groovyls/compiler/util/GroovyReflectionUtils.java index 0c7b5649a..1c06bd7ad 100644 --- a/src/main/java/net/prominic/groovyls/compiler/util/GroovyReflectionUtils.java +++ b/src/main/java/net/prominic/groovyls/compiler/util/GroovyReflectionUtils.java @@ -1,15 +1,12 @@ package net.prominic.groovyls.compiler.util; import com.cleanroommc.groovyscript.sandbox.security.GroovySecurityManager; -import com.google.common.collect.Iterators; import io.github.classgraph.MethodInfo; import net.prominic.groovyls.compiler.ast.ASTContext; import org.codehaus.groovy.ast.MethodNode; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Optional; import java.util.function.Function; public class GroovyReflectionUtils { @@ -17,9 +14,7 @@ public class GroovyReflectionUtils { @Nullable public static Method resolveMethodFromMethodNode(MethodNode methodNode, ASTContext context) { for (Method m : methodNode.getDeclaringClass().getTypeClass().getMethods()) { - if (!GroovySecurityManager.INSTANCE.isValid(m) || - !methodNode.getName().equals(m.getName()) || - methodNode.getParameters().length != m.getParameterCount()) { + if (!GroovySecurityManager.INSTANCE.isValid(m) || !methodNode.getName().equals(m.getName()) || methodNode.getParameters().length != m.getParameterCount()) { continue; } if (matchesParams(m.getParameterTypes(), methodNode.getParameters(), p -> p.getType().getTypeClass())) { @@ -32,14 +27,17 @@ public static Method resolveMethodFromMethodNode(MethodNode methodNode, ASTConte @Nullable public static Method resolveMethodFromMethodInfo(MethodInfo methodInfo, ASTContext context) { for (Method m : methodInfo.getClassInfo().loadClass().getMethods()) { - if (!GroovySecurityManager.INSTANCE.isValid(m) || - !methodInfo.getName().equals(m.getName()) || - methodInfo.getParameterInfo().length != m.getParameterCount()) { + if (!GroovySecurityManager.INSTANCE.isValid(m) || !methodInfo.getName().equals(m.getName()) || methodInfo.getParameterInfo().length != m.getParameterCount()) { continue; } - if (matchesParams(m.getParameterTypes(), methodInfo.getParameterInfo(), - p -> context.getLanguageServerContext().getScanResult().loadClass( - p.getTypeSignatureOrTypeDescriptor().toString(), true))) { + if (matchesParams( + m.getParameterTypes(), + methodInfo.getParameterInfo(), + p -> context.getLanguageServerContext() + .getScanResult() + .loadClass( + p.getTypeSignatureOrTypeDescriptor().toString(), + true))) { return m; } } diff --git a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java index 6ac9d5b39..01227cf47 100644 --- a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java +++ b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactory.java @@ -105,8 +105,10 @@ public GroovyLSCompilationUnit create(Path workspaceRoot, @Nullable URI context) return compilationUnit; } - protected void addDirectoryToCompilationUnit(Path dirPath, GroovyLSCompilationUnit compilationUnit, - FileContentsTracker fileContentsTracker, Set changedUris) { + protected void addDirectoryToCompilationUnit(Path dirPath, + GroovyLSCompilationUnit compilationUnit, + FileContentsTracker fileContentsTracker, + Set changedUris) { try { if (Files.exists(dirPath)) { Files.walk(dirPath).forEach((filePath) -> { diff --git a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java index 342933bef..3c3405f9f 100644 --- a/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java +++ b/src/main/java/net/prominic/groovyls/config/CompilationUnitFactoryBase.java @@ -86,10 +86,12 @@ protected void getClasspathList(List result) { protected void addOpenFileToCompilationUnit(URI uri, String contents, GroovyLSCompilationUnit compilationUnit) { Path filePath = Paths.get(uri); - SourceUnit sourceUnit = new SourceUnit(filePath.toString(), - new StringReaderSourceWithURI(contents, uri, compilationUnit.getConfiguration()), - compilationUnit.getConfiguration(), compilationUnit.getClassLoader(), - compilationUnit.getErrorCollector()); + SourceUnit sourceUnit = new SourceUnit( + filePath.toString(), + new StringReaderSourceWithURI(contents, uri, compilationUnit.getConfiguration()), + compilationUnit.getConfiguration(), + compilationUnit.getClassLoader(), + compilationUnit.getErrorCollector()); compilationUnit.addSource(sourceUnit); } } diff --git a/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java b/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java index 2bb6abc1c..5aa102114 100644 --- a/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/CompletionProvider.java @@ -47,12 +47,68 @@ public class CompletionProvider extends DocProvider { - private static final String[] keywords = {"assert", "case", "break", "continue", "transient", "extends ", "implements ", "enum", "try ", "catch", - "finally", "instanceof ", "super", "private", "public", "protected", "abstract", "const", "default", "goto", - "interface", "native", "non-sealed", "package ", "permits", "record", "sealed", "static", "strictfp", - "synchronized", "threadsafe", "throws", "trait", "var", "yields"}; - private static final String[] popularKeywords = {"def ", "else ", "return", "import ", "class", "this", "null", "true", "false", "void", "byte", - "short", "int", "long", "float", "double", "boolean", "char", "throw ", "new", "in ", "as ", "final "}; + private static final String[] keywords = { + "assert", + "case", + "break", + "continue", + "transient", + "extends ", + "implements ", + "enum", + "try ", + "catch", + "finally", + "instanceof ", + "super", + "private", + "public", + "protected", + "abstract", + "const", + "default", + "goto", + "interface", + "native", + "non-sealed", + "package ", + "permits", + "record", + "sealed", + "static", + "strictfp", + "synchronized", + "threadsafe", + "throws", + "trait", + "var", + "yields" + }; + private static final String[] popularKeywords = { + "def ", + "else ", + "return", + "import ", + "class", + "this", + "null", + "true", + "false", + "void", + "byte", + "short", + "int", + "long", + "float", + "double", + "boolean", + "char", + "throw ", + "new", + "in ", + "as ", + "final " + }; public CompletionProvider(URI doc, ASTContext astContext) { super(doc, astContext); @@ -120,9 +176,7 @@ 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()) { // TODO completions in file() ObjectMapper goh = GroovyASTUtils.getMapperOfNode(expr, astContext); if (goh != null && goh.getCompleter() != null) { @@ -141,7 +195,8 @@ private boolean populateItemsFromConstantExpression(ConstantExpression node, AST return true; } - private void populateItemsFromStaticMethodCallExpression(StaticMethodCallExpression methodCallExpr, Position position, + private void populateItemsFromStaticMethodCallExpression(StaticMethodCallExpression methodCallExpr, + Position position, Completions items) { Set existingNames = new ObjectOpenHashSet<>(); populateItemsFromGlobalScope(methodCallExpr.getMethod(), existingNames, items); @@ -163,8 +218,10 @@ private void populateItemsFromImportNode(ImportNode importNode, Position positio Range importRange = GroovyLSUtils.astNodeToRange(importNode); if (importRange == null) return; // skip the "import " at the beginning - importRange.setStart(new Position(importRange.getEnd().getLine(), - importRange.getEnd().getCharacter() - importNode.getType().getName().length())); + importRange.setStart( + new Position( + importRange.getEnd().getLine(), + importRange.getEnd().getCharacter() - importNode.getType().getName().length())); String importText = getMemberName(importNode.getType().getName(), importRange, position); ModuleNode enclosingModule = getModule(); @@ -177,8 +234,7 @@ private void populateItemsFromImportNode(ImportNode importNode, Position positio } String className = classNode.getName(); String classNameWithoutPackage = classNode.getNameWithoutPackage(); - if ((!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) || - GroovyLSUtils.hasImport(enclosingModule, className)) { + if ((!className.startsWith(importText) && !classNameWithoutPackage.startsWith(importText)) || GroovyLSUtils.hasImport(enclosingModule, className)) { return null; } CompletionItem item = CompletionItemFactory.createCompletion(classNode, classNode.getName(), astContext); @@ -231,7 +287,8 @@ private void populateItemsFromClassNode(ClassNode classNode, Position position, } } - private void populateItemsFromConstructorCallExpression(ConstructorCallExpression constructorCallExpr, Position position, + private void populateItemsFromConstructorCallExpression(ConstructorCallExpression constructorCallExpr, + Position position, Completions items) { Range typeRange = GroovyLSUtils.astNodeToRange(constructorCallExpr.getType()); if (typeRange == null) return; @@ -246,8 +303,10 @@ private void populateItemsFromVariableExpression(VariableExpression varExpr, Pos populateItemsFromScope(varExpr, memberName, items); } - private void populateItemsFromPropertiesAndFields(List properties, List fields, - Set existingNames, Completions items) { + private void populateItemsFromPropertiesAndFields(List properties, + List fields, + Set existingNames, + Completions items) { items.addAll(properties, p -> { String name = p.getName(); if (!p.isPublic() || existingNames.contains(name)) return null; @@ -279,9 +338,7 @@ private void populateItemsFromMethods(List methods, Set exis String name = getDescriptor(method, true, false, false); if (!method.isPublic() || existingNames.contains(name)) return null; existingNames.add(name); - if (method.getDeclaringClass().isResolved() && - (method.getModifiers() & GroovyASTUtils.EXPANSION_MARKER) == 0 && - GroovyReflectionUtils.resolveMethodFromMethodNode(method, astContext) == null) { + if (method.getDeclaringClass().isResolved() && (method.getModifiers() & GroovyASTUtils.EXPANSION_MARKER) == 0 && GroovyReflectionUtils.resolveMethodFromMethodNode(method, astContext) == null) { return null; } @@ -375,9 +432,7 @@ public static String getDescriptor(MethodInfo node, boolean includeName, boolean } builder.append(")"); if (!includeReturn) return builder.toString(); - var ret = display ? - node.getTypeSignatureOrTypeDescriptor().getResultType().toStringWithSimpleNames() : - node.getTypeDescriptor().getResultType().toString(); + var ret = display ? node.getTypeSignatureOrTypeDescriptor().getResultType().toStringWithSimpleNames() : node.getTypeDescriptor().getResultType().toString(); if (!ret.equals("void")) { if (display) builder.append(" -> "); builder.append(ret); @@ -386,9 +441,7 @@ public static String getDescriptor(MethodInfo node, boolean includeName, boolean } public static StringBuilder appendParameter(MethodParameterInfo param, StringBuilder builder, boolean display, boolean maybeVarargs) { - builder.append(display ? - param.getTypeSignatureOrTypeDescriptor().toStringWithSimpleNames() : - param.getTypeDescriptor().toString()); // don't use generic types + builder.append(display ? param.getTypeSignatureOrTypeDescriptor().toStringWithSimpleNames() : param.getTypeDescriptor().toString()); // don't use generic types if (maybeVarargs && builder.charAt(builder.length() - 1) == ']' && builder.charAt(builder.length() - 2) == '[') { builder.delete(builder.length() - 2, builder.length()).append("..."); } @@ -428,7 +481,7 @@ private void populateItemsFromGlobalScope(String memberNamePrefix, Set e String name = entry.getKey(); if (!name.toLowerCase(Locale.ENGLISH).contains(memberNamePrefix) || existingNames.contains(name)) return null; existingNames.add(name); - if (entry.getValue() instanceof ObjectMapper goh) { + if (entry.getValue() instanceof ObjectMappergoh) { for (MethodNode method : goh.getMethodNodes()) { var item = CompletionItemFactory.createCompletion(method, goh.getName(), astContext); item.setLabelDetails(getMethodNodeDetails(method)); @@ -436,7 +489,7 @@ private void populateItemsFromGlobalScope(String memberNamePrefix, Set e items.add(item); } return null; - } else if (entry.getValue() instanceof Closure closure) { + } else if (entry.getValue() instanceof Closureclosure) { MethodNode method = GroovyASTUtils.methodNodeOfClosure(name, closure); var item = CompletionItemFactory.createCompletion(method, name, astContext); item.setLabelDetails(getMethodNodeDetails(method)); @@ -475,7 +528,9 @@ private void populateItemsFromGlobalScope(String memberNamePrefix, Set e }); } - private void populateItemsFromVariableScope(VariableScope variableScope, String memberNamePrefix, Set existingNames, + private void populateItemsFromVariableScope(VariableScope variableScope, + String memberNamePrefix, + Set existingNames, Completions items) { populateItemsFromGlobalScope(memberNamePrefix, existingNames, items); items.addAll(variableScope.getDeclaredVariables().values(), variable -> { @@ -531,8 +586,11 @@ private void populateItemsFromScope(ASTNode node, String namePrefix, Completions } } if (classNode != null) { - populateItemsFromPropertiesAndFields(classNode.getProperties(), classNode.getFields(), - existingNames, items); + populateItemsFromPropertiesAndFields( + classNode.getProperties(), + classNode.getFields(), + existingNames, + items); populateItemsFromMethods(classNode.getMethods(), existingNames, items); } } @@ -552,8 +610,13 @@ private void populateTypes(ASTNode offsetNode, String namePrefix, Set ex populateTypes(offsetNode, namePrefix, existingNames, true, true, true, items); } - private void populateTypes(ASTNode offsetNode, String namePrefix, Set existingNames, boolean includeClasses, - boolean includeInterfaces, boolean includeEnums, Completions items) { + private void populateTypes(ASTNode offsetNode, + String namePrefix, + Set existingNames, + boolean includeClasses, + boolean includeInterfaces, + boolean includeEnums, + Completions items) { Range addImportRange = GroovyASTUtils.findAddImportRange(doc, offsetNode, astContext); ModuleNode enclosingModule = getModule(); @@ -587,8 +650,9 @@ private void populateTypes(ASTNode offsetNode, String namePrefix, Set ex if (!classNameWithoutPackage.startsWith(namePrefix) || existingNames.contains(className)) return null; existingNames.add(className); String packageName = classInfo.getPackageName(); - CompletionItem item = CompletionItemFactory.createCompletion(classInfoToCompletionItemKind(classInfo), - classInfo.getSimpleName()); + CompletionItem item = CompletionItemFactory.createCompletion( + classInfoToCompletionItemKind(classInfo), + classInfo.getSimpleName()); item.setDetail(packageName); boolean hasImport = GroovyLSUtils.hasImport(enclosingModule, className); // sort imported classes higher diff --git a/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java b/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java index aa8e70eba..4864951ed 100644 --- a/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/DefinitionProvider.java @@ -41,7 +41,8 @@ public DefinitionProvider(URI doc, ASTContext astContext) { } public CompletableFuture, List>> provideDefinition( - TextDocumentIdentifier textDocument, Position position) { + TextDocumentIdentifier textDocument, + Position position) { ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(doc, position.getLine(), position.getCharacter()); if (offsetNode == null) { return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList())); diff --git a/src/main/java/net/prominic/groovyls/providers/DocumentSymbolProvider.java b/src/main/java/net/prominic/groovyls/providers/DocumentSymbolProvider.java index 2571b4d58..640eafa09 100644 --- a/src/main/java/net/prominic/groovyls/providers/DocumentSymbolProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/DocumentSymbolProvider.java @@ -40,7 +40,7 @@ public DocumentSymbolProvider(URI doc, ASTContext astContext) { } public CompletableFuture>> provideDocumentSymbolsFuture( - TextDocumentIdentifier textDocument) { + TextDocumentIdentifier textDocument) { return future(provideDocumentSymbols(textDocument)); } diff --git a/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java b/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java index 9c6702a95..f3b537e94 100644 --- a/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java +++ b/src/main/java/net/prominic/groovyls/providers/TypeDefinitionProvider.java @@ -41,7 +41,8 @@ public TypeDefinitionProvider(URI doc, ASTContext astContext) { } public CompletableFuture, List>> provideTypeDefinition( - TextDocumentIdentifier textDocument, Position position) { + TextDocumentIdentifier textDocument, + Position position) { ASTNode offsetNode = astContext.getVisitor().getNodeAtLineAndColumn(doc, position.getLine(), position.getCharacter()); if (offsetNode == null) { return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList())); diff --git a/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java b/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java index 67fb62e13..64eb57659 100644 --- a/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java +++ b/src/main/java/net/prominic/groovyls/util/GroovyNodeToStringUtils.java @@ -64,10 +64,7 @@ public static String classToString(ClassNode classNode, ASTContext astContext) { } public static String constructorToString(ConstructorNode constructorNode, ASTContext astContext) { - String builder = constructorNode.getDeclaringClass().getName() + - "(" + - parametersToString(constructorNode.getParameters(), astContext) + - ")"; + String builder = constructorNode.getDeclaringClass().getName() + "(" + parametersToString(constructorNode.getParameters(), astContext) + ")"; return builder; }