Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banner pattern mod element #3741

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,17 @@
global_templates:
- template: elementinits/bannerpatterns.java.ftl
name: "@SRCROOT/@BASEPACKAGEPATH/init/@JavaModNameBannerPatterns.java"

templates:
- template: json/item.json.ftl
writer: json
name: "@MODASSETSROOT/models/item/@registryname.json"

localizationkeys:
- key: item.@modid.@registryname
mapto: title
- key: item.@modid.@registryname.desc
mapto: description
- fromlist: data.getColorEntries()
key: block.minecraft.banner.@registryname.@[color()]
mapto: getDescription()
1 change: 1 addition & 0 deletions plugins/generator-1.18.2/forge-1.18.2/generator.yaml
Expand Up @@ -31,6 +31,7 @@ effect_textures_dir: "@MODASSETSROOT/textures/mob_effect"
particle_textures_dir: "@MODASSETSROOT/textures/particle"
screen_textures_dir: "@MODASSETSROOT/textures/screens"
armor_textures_dir: "@MODASSETSROOT/textures/models/armor"
banner_textures_dir: "@RESROOT/assets/minecraft/textures/entity"

base_templates:
- template: modbase/mod.java.ftl
Expand Down
@@ -0,0 +1,50 @@
<#--
# MCreator (https://mcreator.net/)
# Copyright (C) 2012-2020, Pylo
# Copyright (C) 2020-2023, Pylo, opensource contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Additional permission for code generator templates (*.ftl files)
#
# As a special exception, you may create a larger work that contains part or
# all of the MCreator code generator templates (*.ftl files) and distribute
# that work under terms of your choice, so long as that work isn't itself a
# template for code generation. Alternatively, if you modify or redistribute
# the template itself, you may (at your option) remove this special exception,
# which will cause the template and the resulting code generator output files
# to be licensed under the GNU General Public License without this special
# exception.
-->

<#-- @formatter:off -->

/*
* MCreator note: This file will be REGENERATED on each build.
*/

package ${package}.init;

public class ${JavaModName}BannerPatterns {

<#list bannerpatterns as bannerpattern>
public static final BannerPattern ${bannerpattern.getModElement().getRegistryNameUpper()} =
addBanner("${bannerpattern.getModElement().getRegistryName()}");
</#list>

public static BannerPattern addBanner(String name) {
return BannerPattern.create(name.toUpperCase(), name, "${modid}." + name, true);
}
}
<#-- @formatter:on -->
Expand Up @@ -61,6 +61,10 @@ public class ${JavaModName}Items {
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()}_BOOTS =
REGISTRY.register("${item.getModElement().getRegistryName()}_boots", () -> new ${item.getModElement().getName()}Item.Boots());
</#if>
<#elseif item.getModElement().getTypeString() == "bannerpattern">
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()} =
REGISTRY.register("${item.getModElement().getRegistryName()}", () -> new BannerPatternItem(${JavaModName}BannerPatterns.${item.getModElement().getRegistryNameUpper()},
new Item.Properties().stacksTo(1).tab(${item.creativeTab})));
<#elseif item.getModElement().getTypeString() == "dimension">
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()} =
REGISTRY.register("${item.getModElement().getRegistryName()}", () -> new ${item.getModElement().getName()}Item());
Expand Down
@@ -0,0 +1,22 @@
global_templates:
- template: bannerpattern/bannerpattern.java.ftl
name: "@SRCROOT/@BASEPACKAGEPATH/init/@JavaModNameBannerPatterns.java"
- template: bannerpattern/bannerpattern_tag_provider.java.ftl
name: "@SRCROOT/@BASEPACKAGEPATH/init/@JavaModNameBannerTagProvider.java"

templates:
- template: json/item.json.ftl
writer: json
name: "@MODASSETSROOT/models/item/@registryname.json"
- template: json/bannerpattern_item_tag.json.ftl
name: "@RESROOT/data/@modid/tags/banner_patterns/pattern_item/@registryname.json"
writer: json

localizationkeys:
- key: item.@modid.@registryname
mapto: title
- key: item.@modid.@registryname.desc
mapto: description
- fromlist: data.getColorEntries()
key: block.minecraft.banner.@registryname.@[color()]
mapto: getDescription()
5 changes: 5 additions & 0 deletions plugins/generator-1.19.2/forge-1.19.2/generator.yaml
Expand Up @@ -34,6 +34,7 @@ effect_textures_dir: "@MODASSETSROOT/textures/mob_effect"
particle_textures_dir: "@MODASSETSROOT/textures/particle"
screen_textures_dir: "@MODASSETSROOT/textures/screens"
armor_textures_dir: "@MODASSETSROOT/textures/models/armor"
banner_textures_dir: "@MODASSETSROOT/textures/entity"

base_templates:
- template: modbase/mod.java.ftl
Expand Down Expand Up @@ -65,6 +66,10 @@ base_templates:
- template: elementinits/javamodels.java.ftl
name: "@SRCROOT/@BASEPACKAGEPATH/init/@JavaModNameModels.java"
condition: hasJavaModels()
- template: modbase/datagenerator.java.ftl
name: "@SRCROOT/@BASEPACKAGEPATH/@JavaModNameDataGenerator.java"
condition_any:
- ${w.hasElementsOfType('bannerpattern')}

sources_setup_tasks:
- task: copy_models
Expand Down
@@ -0,0 +1,58 @@
<#--
# MCreator (https://mcreator.net/)
# Copyright (C) 2012-2020, Pylo
# Copyright (C) 2020-2023, Pylo, opensource contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Additional permission for code generator templates (*.ftl files)
#
# As a special exception, you may create a larger work that contains part or
# all of the MCreator code generator templates (*.ftl files) and distribute
# that work under terms of your choice, so long as that work isn't itself a
# template for code generation. Alternatively, if you modify or redistribute
# the template itself, you may (at your option) remove this special exception,
# which will cause the template and the resulting code generator output files
# to be licensed under the GNU General Public License without this special
# exception.
-->

<#-- @formatter:off -->

/*
* MCreator note: This file will be REGENERATED on each build.
*/

package ${package}.init;

public class ${JavaModName}BannerPatterns {

public static final DeferredRegister<BannerPattern> REGISTRY = DeferredRegister.create(Registry.BANNER_PATTERN_REGISTRY, ${JavaModName}.MODID);

<#list bannerpatterns as bannerpattern>
public static final TagKey<BannerPattern> ${bannerpattern.getModElement().getRegistryNameUpper()}_PATTERN_TAG =
createPatternTag("${bannerpattern.getModElement().getRegistryName()}");
public static final RegistryObject<BannerPattern> ${bannerpattern.getModElement().getRegistryNameUpper()} =
createPattern("${bannerpattern.getModElement().getRegistryName()}");
</#list>

private static TagKey<BannerPattern> createPatternTag(String name) {
return TagKey.create(Registry.BANNER_PATTERN_REGISTRY, new ResourceLocation(${JavaModName}.MODID, name));
}

private static RegistryObject<BannerPattern> createPattern(String name) {
return REGISTRY.register(name, () -> new BannerPattern(${JavaModName}.MODID + "_" + name));
}
}
<#-- @formatter:on -->
@@ -0,0 +1,51 @@
<#--
# MCreator (https://mcreator.net/)
# Copyright (C) 2012-2020, Pylo
# Copyright (C) 2020-2023, Pylo, opensource contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Additional permission for code generator templates (*.ftl files)
#
# As a special exception, you may create a larger work that contains part or
# all of the MCreator code generator templates (*.ftl files) and distribute
# that work under terms of your choice, so long as that work isn't itself a
# template for code generation. Alternatively, if you modify or redistribute
# the template itself, you may (at your option) remove this special exception,
# which will cause the template and the resulting code generator output files
# to be licensed under the GNU General Public License without this special
# exception.
-->

<#-- @formatter:off -->

/*
* MCreator note: This file will be REGENERATED on each build.
*/

package ${package}.init;

public class ${JavaModName}BannerTagProvider extends TagsProvider<BannerPattern> {

public ${JavaModName}BannerTagProvider(DataGenerator dataGenerator, ExistingFileHelper existingFileHelper) {
super(dataGenerator, Registry.BANNER_PATTERN, ${JavaModName}.MODID, existingFileHelper);
}

protected void addTags() {
<#list bannerpatterns as bannerpattern>
this.tag(${JavaModName}BannerPatterns.${bannerpattern.getModElement().getRegistryNameUpper()}_PATTERN_TAG).add(${JavaModName}BannerPatterns.${bannerpattern.getModElement().getRegistryNameUpper()}.get());
</#list>
}
}
<#-- @formatter:on -->
@@ -1,7 +1,7 @@
<#--
# MCreator (https://mcreator.net/)
# Copyright (C) 2012-2020, Pylo
# Copyright (C) 2020-2022, Pylo, opensource contributors
# Copyright (C) 2020-2023, Pylo, opensource contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -61,6 +61,10 @@ public class ${JavaModName}Items {
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()}_BOOTS =
REGISTRY.register("${item.getModElement().getRegistryName()}_boots", () -> new ${item.getModElement().getName()}Item.Boots());
</#if>
<#elseif item.getModElement().getTypeString() == "bannerpattern">
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()} =
REGISTRY.register("${item.getModElement().getRegistryName()}", () -> new BannerPatternItem(${JavaModName}BannerPatterns.${item.getModElement().getRegistryNameUpper()}_PATTERN_TAG,
new Item.Properties().stacksTo(1).tab(${item.creativeTab})));
<#elseif item.getModElement().getTypeString() == "fluid" && item.generateBucket>
public static final RegistryObject<Item> ${item.getModElement().getRegistryNameUpper()}_BUCKET =
REGISTRY.register("${item.getModElement().getRegistryName()}_bucket", () -> new ${item.getModElement().getName()}Item());
Expand Down
@@ -0,0 +1,5 @@
{
"values": [
"${modid}:${data.getModElement().getRegistryName()}"
]
}
@@ -0,0 +1,52 @@
<#--
# MCreator (https://mcreator.net/)
# Copyright (C) 2012-2020, Pylo
# Copyright (C) 2020-2023, Pylo, opensource contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Additional permission for code generator templates (*.ftl files)
#
# As a special exception, you may create a larger work that contains part or
# all of the MCreator code generator templates (*.ftl files) and distribute
# that work under terms of your choice, so long as that work isn't itself a
# template for code generation. Alternatively, if you modify or redistribute
# the template itself, you may (at your option) remove this special exception,
# which will cause the template and the resulting code generator output files
# to be licensed under the GNU General Public License without this special
# exception.
-->

<#-- @formatter:off -->

/*
* MCreator note: This file will be REGENERATED on each build.
*/

package ${package};

@Mod.EventBusSubscriber(modid = "${modid}", bus = Mod.EventBusSubscriber.Bus.MOD) public class ${JavaModName}DataGenerator {

private ${JavaModName}DataGenerator() {}

@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
<#if w.hasElementsOfType("bannerpattern")>
gen.addProvider(event.includeServer(), new ${JavaModName}BannerTagProvider(gen, event.getExistingFileHelper()));
</#if>
}

}
<#-- @formatter:on -->
Expand Up @@ -36,6 +36,10 @@ import org.apache.logging.log4j.Logger;
<#if w.hasElementsOfBaseType("entity")>${JavaModName}Entities.REGISTRY.register(bus);</#if>
<#if w.hasElementsOfBaseType("blockentity")>${JavaModName}BlockEntities.REGISTRY.register(bus);</#if>
<#if w.hasElementsOfBaseType("feature")>${JavaModName}Features.REGISTRY.register(bus);</#if>
<#if w.hasElementsOfType("bannerpattern")>
${JavaModName}BannerPatterns.REGISTRY.register(bus);
bus.addListener(${JavaModName}DataGenerator::gatherData);
</#if>
<#if w.hasElementsOfType("fluid")>
${JavaModName}Fluids.REGISTRY.register(bus);
${JavaModName}FluidTypes.REGISTRY.register(bus);
Expand Down
@@ -0,0 +1 @@
The pattern's texture that will be used on Banners.
@@ -0,0 +1,3 @@
This is where the pattern item will be in creative mode.

Use tabs with CUSTOM: prefix to use custom tabs.
@@ -0,0 +1,3 @@
This parameter defines the description of the pattern.

NOTE: Can be modified, but vanilla patterns usually keep the same title, so the description is what differs and defines each pattern.
@@ -0,0 +1 @@
The pattern's item texture that will be found in the inventory.
@@ -0,0 +1 @@
The pattern's texture that will be used on Shields.
@@ -0,0 +1,3 @@
This parameter defines the title of the pattern.

NOTE: Can be modified, but vanilla patterns usually keep the same title: 'Banner Pattern'
@@ -0,0 +1 @@
La texture du motif qui sera utilisée sur les Bannières.
@@ -0,0 +1,3 @@
C'est là que votre item de motif sera en mode créatif.

Utilisez les onglets avec le préfixe CUSTOM: pour utiliser les onglets personnalisés.
@@ -0,0 +1,3 @@
Ce paramètre définit la description de votre motif.

NOTE: Peut être modifié, mais les motifs vanilla gardent le même titre, donc la description change et définit chaque motif.
@@ -0,0 +1 @@
La texture de l'item de votre motif qui sera dans l'inventaire.
@@ -0,0 +1 @@
La texture du motif qui sera utilisée sur les Boucliers.
@@ -0,0 +1,3 @@
Ce paramètre définit le titre de votre motif.

NOTE: Peut être modifié, mais les motifs vanilla gardent le même titre: 'Motif de bannière'