Skip to content

Commit 75c8c6a

Browse files
committed
Fixed LootTable
1 parent ad2f976 commit 75c8c6a

File tree

5 files changed

+316
-51
lines changed

5 files changed

+316
-51
lines changed

src/main/resources/datapack-1.12.x/templates/loottable.json.ftl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"pools": [
88
<#list data.pools as pool>
99
{
10+
"name": "pool_${pool_index}",
1011
<#if pool.minrolls == pool.maxrolls>
1112
"rolls": ${pool.minrolls},
1213
<#else>
@@ -30,23 +31,23 @@
3031
{
3132
<#assign item = mappedMCItemToRegistryName(entry.item)>
3233
<#if entry.item.isAir() || item == "minecraft:air">
33-
"type": "minecraft:empty",
34+
"type": "empty",
3435
<#else>
35-
"type": "minecraft:${entry.type}",
36+
"type": "${entry.type}",
3637
"name": "${item}",
3738
</#if>
3839
"weight": ${entry.weight},
3940
"functions": [
4041
{
41-
"function": "minecraft:set_count",
42+
"function": "set_count",
4243
"count": {
4344
"min": ${entry.minCount},
4445
"max": ${entry.maxCount}
4546
}
4647
}
4748
<#if entry.minEnchantmentLevel != 0 || entry.maxEnchantmentLevel != 0>
4849
,{
49-
"function": "minecraft:enchant_with_levels",
50+
"function": "enchant_with_levels",
5051
"treasure": true,
5152
"levels": {
5253
"min": ${entry.minEnchantmentLevel},

src/main/resources/forge-1.12.2/loottable.definition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ global_templates:
77
- template: elementinits/loottables.java.ftl
88
name: "@SRCROOT/@BASEPACKAGEPATH/init/@JavaModNameLoottables.java"
99

10-
field_exclusions: [silkTouchMode, affectedByFortune, explosionDecay]
10+
field_exclusions: [Pool.Entry.silkTouchMode, Pool.Entry.affectedByFortune, Pool.Entry.explosionDecay]

src/main/resources/forge-1.12.2/templates/elementinits/loottables.java.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
*/
3535
package ${package}.init;
3636

37-
@Mod.EventBusSubscriber
3837
public class ${JavaModName}Loottables {
3938

40-
@SubscribeEvent public void init(FMLInitializationEvent event) {
39+
public static void load() {
4140
<#list loottables as loottable>
42-
LootTableList.register(new ResourceLocation("${loottable.getNamespace()}", "${loottable.getName()}"));
41+
${JavaModName}.LOGGER.info("HI!");
42+
LootTableList.register(new ResourceLocation("${loottable.getNamespace()}:${loottable.getName()}"));
4343
</#list>
4444
}
4545
}

src/main/resources/forge-1.12.2/templates/modbase/mod.java.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import org.apache.logging.log4j.Logger;
4343
}
4444

4545
@Mod.EventHandler public void init(FMLInitializationEvent event) {
46+
<#if w.hasElementsOfType("loottable")>${JavaModName}Loottables.load();</#if>
4647
<#if w.hasElementsOfType("keybind")>${JavaModName}KeyMappings.registerKeyBindings();</#if>
4748
proxy.init(event);
4849
}

0 commit comments

Comments
 (0)