diff --git a/CHANGELOG.md b/CHANGELOG.md index f433a6e..8ae341a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 5.6.2 +* Added 1.19.4 support +* Removed 1.16.5 support + ## 5.6.1 * Updated to MCreator 2023.1.04717 * [#34] Added Chinese translation (Grey-Wind) diff --git a/README.md b/README.md index 1f2398a..9823031 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ The 2 following examples require File Manager 5.0 or newer. ## Important Information * You need to use MCreator 2021.3.51219 or a newer version -* This version supports Forge 1.18.2, Forge 1.19.2 and Fabric 1.19.2 -* Forge 1.16.5 is included, but it does not receive new features since File Manager 5.5. +* This version supports Forge 1.18.2, 1.19.2 and 1.19.4 and Fabric 1.19.2 and 1.19.4 (when it'll be updated) ## Downloads/Install Instructions Downloads can be found on the [Release page of this repo](https://github.com/Goldorion/File-Manager-MCreator/releases). diff --git a/src/forge-1.16.5/mappings/types.yaml b/src/fabric-1.19.4/mappings/types.yaml similarity index 100% rename from src/forge-1.16.5/mappings/types.yaml rename to src/fabric-1.19.4/mappings/types.yaml diff --git a/src/forge-1.16.5/procedures/add_json_object.java.ftl b/src/fabric-1.19.4/procedures/add_json_object.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/add_json_object.java.ftl rename to src/fabric-1.19.4/procedures/add_json_object.java.ftl diff --git a/src/forge-1.16.5/procedures/add_json_property.java.ftl b/src/fabric-1.19.4/procedures/add_json_property.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/add_json_property.java.ftl rename to src/fabric-1.19.4/procedures/add_json_property.java.ftl diff --git a/src/fabric-1.19.4/procedures/blockstate_to_string.java.ftl b/src/fabric-1.19.4/procedures/blockstate_to_string.java.ftl new file mode 100644 index 0000000..6eb5e9c --- /dev/null +++ b/src/fabric-1.19.4/procedures/blockstate_to_string.java.ftl @@ -0,0 +1,2 @@ +<#include "mcitems.ftl"> +NbtUtils.writeBlockState(${mappedBlockToBlockStateCode(input$blockstate)}).getAsString() \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/copy_file.java.ftl b/src/fabric-1.19.4/procedures/copy_file.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/copy_file.java.ftl rename to src/fabric-1.19.4/procedures/copy_file.java.ftl diff --git a/src/forge-1.16.5/procedures/create_file.java.ftl b/src/fabric-1.19.4/procedures/create_file.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/create_file.java.ftl rename to src/fabric-1.19.4/procedures/create_file.java.ftl diff --git a/src/fabric-1.19.4/procedures/direction_to_number.java.ftl b/src/fabric-1.19.4/procedures/direction_to_number.java.ftl new file mode 100644 index 0000000..743813d --- /dev/null +++ b/src/fabric-1.19.4/procedures/direction_to_number.java.ftl @@ -0,0 +1 @@ +${input$direction}.get3DDataValue() \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/file_exists.java.ftl b/src/fabric-1.19.4/procedures/file_exists.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/file_exists.java.ftl rename to src/fabric-1.19.4/procedures/file_exists.java.ftl diff --git a/src/forge-1.16.5/procedures/file_variable.java.ftl b/src/fabric-1.19.4/procedures/file_variable.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/file_variable.java.ftl rename to src/fabric-1.19.4/procedures/file_variable.java.ftl diff --git a/src/forge-1.16.5/procedures/get_file_name.java.ftl b/src/fabric-1.19.4/procedures/get_file_name.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_file_name.java.ftl rename to src/fabric-1.19.4/procedures/get_file_name.java.ftl diff --git a/src/fabric-1.19.4/procedures/get_game_directory.java.ftl b/src/fabric-1.19.4/procedures/get_game_directory.java.ftl new file mode 100644 index 0000000..4002382 --- /dev/null +++ b/src/fabric-1.19.4/procedures/get_game_directory.java.ftl @@ -0,0 +1 @@ +Minecraft.getInstance().gameDirectory \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/get_json_logic.java.ftl b/src/fabric-1.19.4/procedures/get_json_logic.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_json_logic.java.ftl rename to src/fabric-1.19.4/procedures/get_json_logic.java.ftl diff --git a/src/forge-1.16.5/procedures/get_json_number.java.ftl b/src/fabric-1.19.4/procedures/get_json_number.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_json_number.java.ftl rename to src/fabric-1.19.4/procedures/get_json_number.java.ftl diff --git a/src/forge-1.16.5/procedures/get_json_object.java.ftl b/src/fabric-1.19.4/procedures/get_json_object.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_json_object.java.ftl rename to src/fabric-1.19.4/procedures/get_json_object.java.ftl diff --git a/src/forge-1.16.5/procedures/get_json_text.java.ftl b/src/fabric-1.19.4/procedures/get_json_text.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_json_text.java.ftl rename to src/fabric-1.19.4/procedures/get_json_text.java.ftl diff --git a/src/forge-1.16.5/procedures/json_property_exists.java.ftl b/src/fabric-1.19.4/procedures/json_property_exists.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/json_property_exists.java.ftl rename to src/fabric-1.19.4/procedures/json_property_exists.java.ftl diff --git a/src/forge-1.16.5/procedures/move_file.java.ftl b/src/fabric-1.19.4/procedures/move_file.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/move_file.java.ftl rename to src/fabric-1.19.4/procedures/move_file.java.ftl diff --git a/src/fabric-1.19.4/procedures/number_to_direction.java.ftl b/src/fabric-1.19.4/procedures/number_to_direction.java.ftl new file mode 100644 index 0000000..c8a85d7 --- /dev/null +++ b/src/fabric-1.19.4/procedures/number_to_direction.java.ftl @@ -0,0 +1 @@ +Direction.from3DDataValue(${opt.toInt(input$number)}) \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/parse_json.java.ftl b/src/fabric-1.19.4/procedures/parse_json.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/parse_json.java.ftl rename to src/fabric-1.19.4/procedures/parse_json.java.ftl diff --git a/src/forge-1.16.5/procedures/path_separator.java.ftl b/src/fabric-1.19.4/procedures/path_separator.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/path_separator.java.ftl rename to src/fabric-1.19.4/procedures/path_separator.java.ftl diff --git a/src/forge-1.16.5/procedures/read_json.java.ftl b/src/fabric-1.19.4/procedures/read_json.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/read_json.java.ftl rename to src/fabric-1.19.4/procedures/read_json.java.ftl diff --git a/src/forge-1.16.5/procedures/read_txt.java.ftl b/src/fabric-1.19.4/procedures/read_txt.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/read_txt.java.ftl rename to src/fabric-1.19.4/procedures/read_txt.java.ftl diff --git a/src/forge-1.16.5/procedures/string_iterator.java.ftl b/src/fabric-1.19.4/procedures/string_iterator.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/string_iterator.java.ftl rename to src/fabric-1.19.4/procedures/string_iterator.java.ftl diff --git a/src/fabric-1.19.4/procedures/string_to_blockstate.java.ftl b/src/fabric-1.19.4/procedures/string_to_blockstate.java.ftl new file mode 100644 index 0000000..2e12575 --- /dev/null +++ b/src/fabric-1.19.4/procedures/string_to_blockstate.java.ftl @@ -0,0 +1,10 @@ +/*@BlockState*/new Object() { + public BlockState getBlockState(String _nbt) { + try { + return NbtUtils.readBlockState(TagParser.parseTag(_nbt)); + } catch (CommandSyntaxException e) { + ${JavaModName}.LOGGER.error(e); + return Blocks.AIR.defaultBlockState(); + } + } +}.getBlockState(${input$string}) \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/stringify_json.java.ftl b/src/fabric-1.19.4/procedures/stringify_json.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/stringify_json.java.ftl rename to src/fabric-1.19.4/procedures/stringify_json.java.ftl diff --git a/src/forge-1.16.5/procedures/url_to_file.java.ftl b/src/fabric-1.19.4/procedures/url_to_file.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/url_to_file.java.ftl rename to src/fabric-1.19.4/procedures/url_to_file.java.ftl diff --git a/src/forge-1.16.5/procedures/write_json.java.ftl b/src/fabric-1.19.4/procedures/write_json.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/write_json.java.ftl rename to src/fabric-1.19.4/procedures/write_json.java.ftl diff --git a/src/forge-1.16.5/procedures/write_line.java.ftl b/src/fabric-1.19.4/procedures/write_line.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/write_line.java.ftl rename to src/fabric-1.19.4/procedures/write_line.java.ftl diff --git a/src/forge-1.16.5/procedures/write_txt.java.ftl b/src/fabric-1.19.4/procedures/write_txt.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/write_txt.java.ftl rename to src/fabric-1.19.4/procedures/write_txt.java.ftl diff --git a/src/forge-1.16.5/variables/file.yaml b/src/fabric-1.19.4/variables/file.yaml similarity index 100% rename from src/forge-1.16.5/variables/file.yaml rename to src/fabric-1.19.4/variables/file.yaml diff --git a/src/forge-1.16.5/variables/jsonobject.yaml b/src/fabric-1.19.4/variables/jsonobject.yaml similarity index 100% rename from src/forge-1.16.5/variables/jsonobject.yaml rename to src/fabric-1.19.4/variables/jsonobject.yaml diff --git a/src/forge-1.19.4/mappings/types.yaml b/src/forge-1.19.4/mappings/types.yaml new file mode 100644 index 0000000..e817c5c --- /dev/null +++ b/src/forge-1.19.4/mappings/types.yaml @@ -0,0 +1,2 @@ +file: File +jsonobject: com.google.gson.JsonObject \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/add_json_object.java.ftl b/src/forge-1.19.4/procedures/add_json_object.java.ftl new file mode 100644 index 0000000..f1be071 --- /dev/null +++ b/src/forge-1.19.4/procedures/add_json_object.java.ftl @@ -0,0 +1 @@ +${field$JOBJVAR?replace("local:", "")?replace("global:", "")}.add(${input$name}, ${field$VAR?replace("local:", "")?replace("global:", "")}); \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/add_json_property.java.ftl b/src/forge-1.19.4/procedures/add_json_property.java.ftl new file mode 100644 index 0000000..a2dfb36 --- /dev/null +++ b/src/forge-1.19.4/procedures/add_json_property.java.ftl @@ -0,0 +1 @@ +${field$JOBJVAR?replace("local:", "")?replace("global:", "")}.addProperty(${input$name}, ${input$value}); \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/blockstate_to_string.java.ftl b/src/forge-1.19.4/procedures/blockstate_to_string.java.ftl new file mode 100644 index 0000000..6eb5e9c --- /dev/null +++ b/src/forge-1.19.4/procedures/blockstate_to_string.java.ftl @@ -0,0 +1,2 @@ +<#include "mcitems.ftl"> +NbtUtils.writeBlockState(${mappedBlockToBlockStateCode(input$blockstate)}).getAsString() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/copy_file.java.ftl b/src/forge-1.19.4/procedures/copy_file.java.ftl new file mode 100644 index 0000000..fea4640 --- /dev/null +++ b/src/forge-1.19.4/procedures/copy_file.java.ftl @@ -0,0 +1,5 @@ +try { + org.apache.commons.io.FileUtils.copyFile(${field$VAR?replace("local:", "")?replace("global:", "")}, new File(${input$toLocation})); +} catch (IOException e) { + ${JavaModName}.LOGGER.error(e); +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/create_file.java.ftl b/src/forge-1.19.4/procedures/create_file.java.ftl new file mode 100644 index 0000000..704ab78 --- /dev/null +++ b/src/forge-1.19.4/procedures/create_file.java.ftl @@ -0,0 +1,6 @@ +try { + ${field$VAR?replace("local:", "")?replace("global:", "")}.getParentFile().mkdirs(); + ${field$VAR?replace("local:", "")?replace("global:", "")}.createNewFile(); +} catch (IOException exception) { + exception.printStackTrace(); +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/direction_to_number.java.ftl b/src/forge-1.19.4/procedures/direction_to_number.java.ftl new file mode 100644 index 0000000..743813d --- /dev/null +++ b/src/forge-1.19.4/procedures/direction_to_number.java.ftl @@ -0,0 +1 @@ +${input$direction}.get3DDataValue() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/file_exists.java.ftl b/src/forge-1.19.4/procedures/file_exists.java.ftl new file mode 100644 index 0000000..4bb16e2 --- /dev/null +++ b/src/forge-1.19.4/procedures/file_exists.java.ftl @@ -0,0 +1 @@ +${field$VAR?replace("local:", "")?replace("global:", "")}.exists() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/file_variable.java.ftl b/src/forge-1.19.4/procedures/file_variable.java.ftl new file mode 100644 index 0000000..ad907d9 --- /dev/null +++ b/src/forge-1.19.4/procedures/file_variable.java.ftl @@ -0,0 +1 @@ +new File(${input$location}, File.separator + ${input$name}) \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/get_file_name.java.ftl b/src/forge-1.19.4/procedures/get_file_name.java.ftl new file mode 100644 index 0000000..2ec8ae0 --- /dev/null +++ b/src/forge-1.19.4/procedures/get_file_name.java.ftl @@ -0,0 +1 @@ +${field$VAR?replace("local:", "")?replace("global:", "")}.getName() \ No newline at end of file diff --git a/src/forge-1.16.5/procedures/get_game_directory.java.ftl b/src/forge-1.19.4/procedures/get_game_directory.java.ftl similarity index 100% rename from src/forge-1.16.5/procedures/get_game_directory.java.ftl rename to src/forge-1.19.4/procedures/get_game_directory.java.ftl diff --git a/src/forge-1.19.4/procedures/get_json_logic.java.ftl b/src/forge-1.19.4/procedures/get_json_logic.java.ftl new file mode 100644 index 0000000..899d30d --- /dev/null +++ b/src/forge-1.19.4/procedures/get_json_logic.java.ftl @@ -0,0 +1 @@ +${field$VAR?replace("local:", "")?replace("global:", "")}.get(${input$name}).getAsBoolean() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/get_json_number.java.ftl b/src/forge-1.19.4/procedures/get_json_number.java.ftl new file mode 100644 index 0000000..c3e4b15 --- /dev/null +++ b/src/forge-1.19.4/procedures/get_json_number.java.ftl @@ -0,0 +1 @@ +${field$VAR?replace("local:", "")?replace("global:", "")}.get(${input$name}).getAsDouble() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/get_json_object.java.ftl b/src/forge-1.19.4/procedures/get_json_object.java.ftl new file mode 100644 index 0000000..3ac616a --- /dev/null +++ b/src/forge-1.19.4/procedures/get_json_object.java.ftl @@ -0,0 +1 @@ +${field$JOBJVAR?replace("local:", "")?replace("global:", "")}.get(${input$name}).getAsJsonObject() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/get_json_text.java.ftl b/src/forge-1.19.4/procedures/get_json_text.java.ftl new file mode 100644 index 0000000..93f5e9b --- /dev/null +++ b/src/forge-1.19.4/procedures/get_json_text.java.ftl @@ -0,0 +1 @@ +${field$VAR?replace("local:", "")?replace("global:", "")}.get(${input$name}).getAsString() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/json_property_exists.java.ftl b/src/forge-1.19.4/procedures/json_property_exists.java.ftl new file mode 100644 index 0000000..e751573 --- /dev/null +++ b/src/forge-1.19.4/procedures/json_property_exists.java.ftl @@ -0,0 +1 @@ +(${field$VAR?replace("local:", "")?replace("global:", "")}.get(${input$name}) != null) \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/move_file.java.ftl b/src/forge-1.19.4/procedures/move_file.java.ftl new file mode 100644 index 0000000..25665da --- /dev/null +++ b/src/forge-1.19.4/procedures/move_file.java.ftl @@ -0,0 +1,5 @@ +try { + org.apache.commons.io.FileUtils.moveFile(${field$VAR?replace("local:", "")?replace("global:", "")}, new File(${input$toLocation})); +} catch (IOException e) { + ${JavaModName}.LOGGER.error(e); +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/number_to_direction.java.ftl b/src/forge-1.19.4/procedures/number_to_direction.java.ftl new file mode 100644 index 0000000..c8a85d7 --- /dev/null +++ b/src/forge-1.19.4/procedures/number_to_direction.java.ftl @@ -0,0 +1 @@ +Direction.from3DDataValue(${opt.toInt(input$number)}) \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/parse_json.java.ftl b/src/forge-1.19.4/procedures/parse_json.java.ftl new file mode 100644 index 0000000..40e7c3c --- /dev/null +++ b/src/forge-1.19.4/procedures/parse_json.java.ftl @@ -0,0 +1,10 @@ +(new Object(){ + public JsonObject parse(String rawJson){ + try { + return new Gson().fromJson(rawJson, com.google.gson.JsonObject.class); + } catch (Exception e) { + ${JavaModName}.LOGGER.error(e); + return new Gson().fromJson("{}", com.google.gson.JsonObject.class); + } + } +}.parse(${input$json})) \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/path_separator.java.ftl b/src/forge-1.19.4/procedures/path_separator.java.ftl new file mode 100644 index 0000000..db48a9b --- /dev/null +++ b/src/forge-1.19.4/procedures/path_separator.java.ftl @@ -0,0 +1 @@ +File.separator \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/read_json.java.ftl b/src/forge-1.19.4/procedures/read_json.java.ftl new file mode 100644 index 0000000..194fefd --- /dev/null +++ b/src/forge-1.19.4/procedures/read_json.java.ftl @@ -0,0 +1,17 @@ +{ + try { + BufferedReader bufferedReader = new BufferedReader(new FileReader(${field$VAR?replace("local:", "")?replace("global:", "")})); + StringBuilder jsonstringbuilder = new StringBuilder(); + String line; + while((line = bufferedReader.readLine()) != null) { + jsonstringbuilder.append(line); + } + bufferedReader.close(); + + ${field$JOBJVAR?replace("local:", "")?replace("global:", "")} = new Gson().fromJson(jsonstringbuilder.toString(), com.google.gson.JsonObject.class); + ${statement$values} + + } catch (IOException e) { + e.printStackTrace(); + } +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/read_txt.java.ftl b/src/forge-1.19.4/procedures/read_txt.java.ftl new file mode 100644 index 0000000..0812342 --- /dev/null +++ b/src/forge-1.19.4/procedures/read_txt.java.ftl @@ -0,0 +1,10 @@ +try { + BufferedReader ${field$VAR?replace("local:", "")?replace("global:", "")}Reader = new BufferedReader(new FileReader(${field$VAR?replace("local:", "")?replace("global:", "")})); + String stringiterator = ""; + while((stringiterator = ${field$VAR?replace("local:", "")?replace("global:", "")}Reader.readLine()) != null) { + ${statement$foreach} + } + ${field$VAR?replace("local:", "")?replace("global:", "")}Reader.close(); +} catch (IOException e) { + e.printStackTrace(); +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/string_iterator.java.ftl b/src/forge-1.19.4/procedures/string_iterator.java.ftl new file mode 100644 index 0000000..fa9561e --- /dev/null +++ b/src/forge-1.19.4/procedures/string_iterator.java.ftl @@ -0,0 +1 @@ +stringiterator \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/string_to_blockstate.java.ftl b/src/forge-1.19.4/procedures/string_to_blockstate.java.ftl new file mode 100644 index 0000000..2e12575 --- /dev/null +++ b/src/forge-1.19.4/procedures/string_to_blockstate.java.ftl @@ -0,0 +1,10 @@ +/*@BlockState*/new Object() { + public BlockState getBlockState(String _nbt) { + try { + return NbtUtils.readBlockState(TagParser.parseTag(_nbt)); + } catch (CommandSyntaxException e) { + ${JavaModName}.LOGGER.error(e); + return Blocks.AIR.defaultBlockState(); + } + } +}.getBlockState(${input$string}) \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/stringify_json.java.ftl b/src/forge-1.19.4/procedures/stringify_json.java.ftl new file mode 100644 index 0000000..05de98e --- /dev/null +++ b/src/forge-1.19.4/procedures/stringify_json.java.ftl @@ -0,0 +1 @@ +${field$JOBJVAR?replace("local:", "")?replace("global:", "")}.toString() \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/url_to_file.java.ftl b/src/forge-1.19.4/procedures/url_to_file.java.ftl new file mode 100644 index 0000000..284d367 --- /dev/null +++ b/src/forge-1.19.4/procedures/url_to_file.java.ftl @@ -0,0 +1,5 @@ +try { + FileUtils.copyURLToFile(new URL(${url}), ${field$VAR?replace("local:", "")?replace("global:", "")}, ${input$connectionTimeout}, ${input$readTimeout); +} catch (IOException e) { + e.printStackTrace(); +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/write_json.java.ftl b/src/forge-1.19.4/procedures/write_json.java.ftl new file mode 100644 index 0000000..7abf605 --- /dev/null +++ b/src/forge-1.19.4/procedures/write_json.java.ftl @@ -0,0 +1,11 @@ +{ + Gson mainGSONBuilderVariable = new GsonBuilder().setPrettyPrinting().create(); + + try { + FileWriter fileWriter = new FileWriter(${field$VAR?replace("local:", "")?replace("global:", "")}); + fileWriter.write(mainGSONBuilderVariable.toJson(${field$JOBJVAR?replace("local:", "")?replace("global:", "")})); + fileWriter.close(); + } catch (IOException exception) { + exception.printStackTrace(); + } +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/write_line.java.ftl b/src/forge-1.19.4/procedures/write_line.java.ftl new file mode 100644 index 0000000..304a061 --- /dev/null +++ b/src/forge-1.19.4/procedures/write_line.java.ftl @@ -0,0 +1,6 @@ +{ + ${field$VAR?replace("local:", "")?replace("global:", "")}bw.write(${input$text}); + <#if input$newLine == "(true)"> + ${field$VAR?replace("local:", "")?replace("global:", "")}bw.newLine(); + +} \ No newline at end of file diff --git a/src/forge-1.19.4/procedures/write_txt.java.ftl b/src/forge-1.19.4/procedures/write_txt.java.ftl new file mode 100644 index 0000000..dedbe52 --- /dev/null +++ b/src/forge-1.19.4/procedures/write_txt.java.ftl @@ -0,0 +1,11 @@ +try { + FileWriter ${field$VAR?replace("local:", "")?replace("global:", "")}writer = new FileWriter(${field$VAR?replace("local:", "")?replace("global:", "")}); + BufferedWriter ${field$VAR?replace("local:", "")?replace("global:", "")}bw = new BufferedWriter(${field$VAR?replace("local:", "")?replace("global:", "")}writer); + + ${statement$text} + + ${field$VAR?replace("local:", "")?replace("global:", "")}bw.close(); + ${field$VAR?replace("local:", "")?replace("global:", "")}writer.close(); +} catch (IOException exception) { + exception.printStackTrace(); +} \ No newline at end of file diff --git a/src/forge-1.19.4/variables/file.yaml b/src/forge-1.19.4/variables/file.yaml new file mode 100644 index 0000000..0510d2a --- /dev/null +++ b/src/forge-1.19.4/variables/file.yaml @@ -0,0 +1,10 @@ +defaultvalue: new File("") +scopes: + local: + init: ${var.getType().getJavaType(generator.getWorkspace())} ${var.getName()} = ${var.getType().getDefaultValue(generator.getWorkspace())}; + get: ${name} + set: ${name} = ${opt.removeParentheses(value)}; + global_session: + init: public static File ${var.getName()} = ${var.getValue()}; + get: ${JavaModName}Variables.${name} + set: ${JavaModName}Variables.${name} = ${opt.removeParentheses(value)}; \ No newline at end of file diff --git a/src/forge-1.19.4/variables/jsonobject.yaml b/src/forge-1.19.4/variables/jsonobject.yaml new file mode 100644 index 0000000..e5912f6 --- /dev/null +++ b/src/forge-1.19.4/variables/jsonobject.yaml @@ -0,0 +1,6 @@ +defaultvalue: new com.google.gson.JsonObject() +scopes: + local: + init: ${var.getType().getJavaType(generator.getWorkspace())} ${var.getName()} = ${var.getType().getDefaultValue(generator.getWorkspace())}; + get: ${name} + set: ${name} = ${opt.removeParentheses(value)}; \ No newline at end of file diff --git a/src/plugin.json b/src/plugin.json index d673960..29e2034 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -5,7 +5,7 @@ "name": "File Manager", "description": "Create and read your files", "author": "Goldorion", - "version": "5.6.1", + "version": "5.6.2", "updateJSONURL": "https://raw.githubusercontent.com/Goldorion/File-Manager-MCreator/master/update.json", "pluginPageID": 64638 } diff --git a/update.json b/update.json index f42b9ab..cacace2 100644 --- a/update.json +++ b/update.json @@ -1,5 +1,5 @@ { "file-manager": { - "latest": "5.6.1" + "latest": "5.6.2" } }