add loot tables for akashic leaves

This commit is contained in:
yrsegal@gmail.com 2022-04-20 17:34:14 -04:00
parent f950ab375e
commit 7cb17a4f27
5 changed files with 141 additions and 0 deletions

View file

@ -409,6 +409,9 @@ afecba3144e00505977a4ab4de7940f949ab7818 data/hexcasting/loot_modifiers/scroll_d
cfd72df535fe95cd2b0d800696e7b4b3429a0459 data/hexcasting/loot_tables/blocks/akashic_bookshelf.json
2e5958279471fa57ae2929d9f9da46e59495f50e data/hexcasting/loot_tables/blocks/akashic_connector.json
3794453f5412af9c7307c9cd91fe2d01ffb763af data/hexcasting/loot_tables/blocks/akashic_door.json
e05da321f00ce09c6f4ad3f6da95ae3dc93e7748 data/hexcasting/loot_tables/blocks/akashic_leaves1.json
224d9bad572916bc9d5d5a749cc7261a8dad17d7 data/hexcasting/loot_tables/blocks/akashic_leaves2.json
58a8470e73b0364f033bac76d6f31c009394fcaa data/hexcasting/loot_tables/blocks/akashic_leaves3.json
4b0b1c0a353b8768c1c56d8dc4764a10c2cd7c5f data/hexcasting/loot_tables/blocks/akashic_log.json
ff25315e494e3b79667a1fa90d22a80d0eb6d208 data/hexcasting/loot_tables/blocks/akashic_log_stripped.json
7400ffa5214a5d7ed34be2ac2ffcc2b50cdf299c data/hexcasting/loot_tables/blocks/akashic_panel.json

View file

@ -0,0 +1,40 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "akashic_leaves1",
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "hexcasting:akashic_leaves1"
}
],
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "forge:can_tool_perform_action",
"action": "shears_dig"
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
]
}
]
}

View file

@ -0,0 +1,40 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "akashic_leaves2",
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "hexcasting:akashic_leaves2"
}
],
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "forge:can_tool_perform_action",
"action": "shears_dig"
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
]
}
]
}

View file

@ -0,0 +1,40 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "akashic_leaves3",
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "hexcasting:akashic_leaves3"
}
],
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "forge:can_tool_perform_action",
"action": "shears_dig"
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
]
}
]
}

View file

@ -3,8 +3,12 @@ package at.petrak.hexcasting.datagen;
import at.petrak.hexcasting.common.blocks.HexBlocks;
import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate;
import at.petrak.paucal.api.datagen.PaucalLootTableProvider;
import net.minecraft.advancements.critereon.EnchantmentPredicate;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
import net.minecraft.data.DataGenerator;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
@ -12,9 +16,13 @@ import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction;
import net.minecraft.world.level.storage.loot.predicates.AlternativeLootItemCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
import net.minecraft.world.level.storage.loot.predicates.MatchTool;
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraftforge.common.ToolActions;
import net.minecraftforge.common.loot.CanToolPerformAction;
import java.util.Map;
@ -39,6 +47,16 @@ public class HexLootTables extends PaucalLootTableProvider {
HexBlocks.AKASHIC_PLANKS, HexBlocks.AKASHIC_TILE, HexBlocks.AKASHIC_PANEL,
HexBlocks.AKASHIC_TRAPDOOR);
for (Block block : new Block[] { HexBlocks.AKASHIC_LEAVES1.get(), HexBlocks.AKASHIC_LEAVES2.get(), HexBlocks.AKASHIC_LEAVES3.get()}) {
var leafPool = dropThisPool(block, 1)
.when(new AlternativeLootItemCondition.Builder(
CanToolPerformAction.canToolPerformAction(ToolActions.SHEARS_DIG),
MatchTool.toolMatches(ItemPredicate.Builder.item()
.hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1))))
));
lootTables.put(block, LootTable.lootTable().withPool(leafPool));
}
var slatePool = LootPool.lootPool().name("slate").
setRolls(ConstantValue.exactly(1))
.add(LootItem.lootTableItem(HexBlocks.SLATE.get())