From 492f1c67d730b24c4f426ed000935a56fe33c09a Mon Sep 17 00:00:00 2001 From: Goldorion Date: Wed, 28 Jul 2021 12:25:33 -0400 Subject: [PATCH] Custom paintings --- changelog.md | 1 + src/fabric-1.16.5/painting.definition.yaml | 3 +++ .../templates/modbase/mod.java.ftl | 6 +++++ src/fabric-1.16.5/templates/painting.java.ftl | 26 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 src/fabric-1.16.5/painting.definition.yaml create mode 100644 src/fabric-1.16.5/templates/painting.java.ftl diff --git a/changelog.md b/changelog.md index aba366f8..4d9f3cb0 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ Another version will be made to support entirely MCreator 2021.2 * Updated to Fabric API 0.37.1 * Improved generated code for custom armors +* Added support for the painting mod element * [#124] Added support for tooltips for each armor item * Added knockback resistance support for custom armors * [Bugfix #113] Workspaces could not build properly. diff --git a/src/fabric-1.16.5/painting.definition.yaml b/src/fabric-1.16.5/painting.definition.yaml new file mode 100644 index 00000000..1b3ec9db --- /dev/null +++ b/src/fabric-1.16.5/painting.definition.yaml @@ -0,0 +1,3 @@ +templates: + - template: painting.java.ftl + name: "@SRCROOT/@BASEPACKAGEPATH/painting/@NAMEPainting.java" \ No newline at end of file diff --git a/src/fabric-1.16.5/templates/modbase/mod.java.ftl b/src/fabric-1.16.5/templates/modbase/mod.java.ftl index 5dc4040a..2e48a2bc 100644 --- a/src/fabric-1.16.5/templates/modbase/mod.java.ftl +++ b/src/fabric-1.16.5/templates/modbase/mod.java.ftl @@ -127,6 +127,12 @@ public class ${JavaModName} implements ModInitializer { +<#list w.getElementsOfType("PAINTING") as painting> + <#assign ge = painting.getGeneratableElement()> + public static final PaintingMotive ${painting} = Registry.register(Registry.PAINTING_MOTIVE, + id("${painting.getRegistryName()}"), ${painting}Painting.painting); + + @Override public void onInitialize() { LOGGER.info("Initializing ${JavaModName}"); diff --git a/src/fabric-1.16.5/templates/painting.java.ftl b/src/fabric-1.16.5/templates/painting.java.ftl new file mode 100644 index 00000000..be2467a0 --- /dev/null +++ b/src/fabric-1.16.5/templates/painting.java.ftl @@ -0,0 +1,26 @@ +<#-- +This file is part of Fabric-Generator-MCreator. + +Fabric-Generator-MCreator is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Fabric-Generator-MCreator is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with Fabric-Generator-MCreator. If not, see . +--> + +<#-- @formatter:off --> + +package ${package}.painting; + +public class ${name}Painting { + + public static PaintingMotive painting = new PaintingMotive(${data.width}, ${data.height}); +} +<#-- @formatter:on --> \ No newline at end of file