1.2.8
All checks were successful
SorceryCraft/pipeline/head This commit looks good

Register Loot Table Function
This commit is contained in:
TheBrokenRail 2020-04-11 13:47:24 -04:00
parent 55808ca049
commit 504a52597d
4 changed files with 25 additions and 5 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.2.8**
* Register Loot Table Function
**1.2.7** **1.2.7**
* Fix Cooling Spell Bug * Fix Cooling Spell Bug

View File

@ -3,20 +3,20 @@ org.gradle.jvmargs = -Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version = 20w14a minecraft_version = 20w15a
curseforge_id = 365308 curseforge_id = 365308
simple_minecraft_version = 1.16-Snapshot simple_minecraft_version = 1.16-Snapshot
yarn_build = 2 yarn_build = 4
fabric_loader_version = 0.7.9+build.190 fabric_loader_version = 0.8.2+build.194
# Mod Properties # Mod Properties
mod_version = 1.2.7 mod_version = 1.2.8
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = sorcerycraft archives_base_name = sorcerycraft
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # 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 cloth_config_version = 3.2.1-unstable
auto_config_version = 1.2.4 auto_config_version = 1.2.4
mod_menu_version = 1.11.1+build.3 mod_menu_version = 1.11.1+build.3

View File

@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.loot.BinomialLootTableRange; import net.minecraft.loot.BinomialLootTableRange;
import net.minecraft.loot.LootTables; import net.minecraft.loot.LootTables;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.function.LootFunctions;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
@ -96,6 +97,7 @@ public class SorceryCraft implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
//noinspection InstantiationOfUtilityClass
new Spells(); new Spells();
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
@ -136,6 +138,7 @@ public class SorceryCraft implements ModInitializer {
supplier.withPool(poolBuilder); supplier.withPool(poolBuilder);
} }
}); });
LootFunctions.register(new RandomSpellLootTableFunction.Factory());
DispenserBlock.registerBehavior(SorceryCraft.SPELL_ITEM, new ProjectileDispenserBehavior() { DispenserBlock.registerBehavior(SorceryCraft.SPELL_ITEM, new ProjectileDispenserBehavior() {
@Override @Override

View File

@ -1,5 +1,8 @@
package com.thebrokenrail.sorcerycraft.spell.util; 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.Spell;
import com.thebrokenrail.sorcerycraft.spell.api.registry.SpellRegistry; import com.thebrokenrail.sorcerycraft.spell.api.registry.SpellRegistry;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -29,6 +32,17 @@ public class RandomSpellLootTableFunction extends ConditionalLootFunction {
return stack; return stack;
} }
public static class Factory extends ConditionalLootFunction.Factory<RandomSpellLootTableFunction> {
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<RandomSpellLootTableFunction.Builder> { public static class Builder extends ConditionalLootFunction.Builder<RandomSpellLootTableFunction.Builder> {
@Override @Override
protected RandomSpellLootTableFunction.Builder getThisBuilder() { protected RandomSpellLootTableFunction.Builder getThisBuilder() {