diff --git a/CHANGELOG.md b/CHANGELOG.md index c11da0e..1cd8d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**1.2.8** +* Register Loot Table Function + **1.2.7** * Fix Cooling Spell Bug diff --git a/gradle.properties b/gradle.properties index 1aeb1d6..d0bf431 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,20 +3,20 @@ org.gradle.jvmargs = -Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version = 20w14a + minecraft_version = 20w15a curseforge_id = 365308 simple_minecraft_version = 1.16-Snapshot - yarn_build = 2 - fabric_loader_version = 0.7.9+build.190 + yarn_build = 4 + fabric_loader_version = 0.8.2+build.194 # Mod Properties - mod_version = 1.2.7 + mod_version = 1.2.8 maven_group = com.thebrokenrail archives_base_name = sorcerycraft # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_api_version = 0.5.6+build.313-1.16 + fabric_api_version = 0.5.9+build.319-1.16 cloth_config_version = 3.2.1-unstable auto_config_version = 1.2.4 mod_menu_version = 1.11.1+build.3 diff --git a/src/main/java/com/thebrokenrail/sorcerycraft/SorceryCraft.java b/src/main/java/com/thebrokenrail/sorcerycraft/SorceryCraft.java index 3bc31d3..b9d884d 100644 --- a/src/main/java/com/thebrokenrail/sorcerycraft/SorceryCraft.java +++ b/src/main/java/com/thebrokenrail/sorcerycraft/SorceryCraft.java @@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.loot.BinomialLootTableRange; import net.minecraft.loot.LootTables; import net.minecraft.loot.entry.ItemEntry; +import net.minecraft.loot.function.LootFunctions; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; @@ -96,6 +97,7 @@ public class SorceryCraft implements ModInitializer { @Override public void onInitialize() { + //noinspection InstantiationOfUtilityClass new Spells(); AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); @@ -136,6 +138,7 @@ public class SorceryCraft implements ModInitializer { supplier.withPool(poolBuilder); } }); + LootFunctions.register(new RandomSpellLootTableFunction.Factory()); DispenserBlock.registerBehavior(SorceryCraft.SPELL_ITEM, new ProjectileDispenserBehavior() { @Override diff --git a/src/main/java/com/thebrokenrail/sorcerycraft/spell/util/RandomSpellLootTableFunction.java b/src/main/java/com/thebrokenrail/sorcerycraft/spell/util/RandomSpellLootTableFunction.java index fd0758f..63d0a13 100644 --- a/src/main/java/com/thebrokenrail/sorcerycraft/spell/util/RandomSpellLootTableFunction.java +++ b/src/main/java/com/thebrokenrail/sorcerycraft/spell/util/RandomSpellLootTableFunction.java @@ -1,5 +1,8 @@ package com.thebrokenrail.sorcerycraft.spell.util; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.thebrokenrail.sorcerycraft.SorceryCraft; import com.thebrokenrail.sorcerycraft.spell.api.Spell; import com.thebrokenrail.sorcerycraft.spell.api.registry.SpellRegistry; import net.minecraft.item.ItemStack; @@ -29,6 +32,17 @@ public class RandomSpellLootTableFunction extends ConditionalLootFunction { return stack; } + public static class Factory extends ConditionalLootFunction.Factory { + public Factory() { + super(new Identifier(SorceryCraft.NAMESPACE, "random_spell"), RandomSpellLootTableFunction.class); + } + + @Override + public RandomSpellLootTableFunction fromJson(JsonObject json, JsonDeserializationContext context, LootCondition[] conditions) { + return (RandomSpellLootTableFunction) new Builder().build(); + } + } + public static class Builder extends ConditionalLootFunction.Builder { @Override protected RandomSpellLootTableFunction.Builder getThisBuilder() {