push for loot table help

This commit is contained in:
gamma-delta 2022-03-29 12:39:18 -05:00
parent 6cf4523d11
commit 176829c90b
9 changed files with 165 additions and 170 deletions

View file

@ -194,7 +194,7 @@ cc66962ddeef9b9c3a623eef178b352605f1c922 assets/hexcasting/models/item/slate_blo
eeaa26fe380975188cd2d6a93bd5e324dc509767 assets/hexcasting/models/item/trinket_filled.json eeaa26fe380975188cd2d6a93bd5e324dc509767 assets/hexcasting/models/item/trinket_filled.json
c534699d2cd118163b43d4a2557f2a7b1e5cc0b6 assets/hexcasting/models/item/uuid_colorizer.json c534699d2cd118163b43d4a2557f2a7b1e5cc0b6 assets/hexcasting/models/item/uuid_colorizer.json
5847c79fce9ef3fd26b03b80d586beed6ff4c354 assets/hexcasting/models/item/wand.json 5847c79fce9ef3fd26b03b80d586beed6ff4c354 assets/hexcasting/models/item/wand.json
637e118fc7c371db684d0d831a46833b5851e582 data/forge/loot_modifiers/global_loot_modifiers.json 297e610e63a09a198775d4c4f7ef861a111364cb data/forge/loot_modifiers/global_loot_modifiers.json
b6593ea802a692c29b5032292df31beb84878ad8 data/hexcasting/advancements/aaa_wasteful_cast.json b6593ea802a692c29b5032292df31beb84878ad8 data/hexcasting/advancements/aaa_wasteful_cast.json
4f4c94021adfb296e3ef3dce1acc46f724f38f92 data/hexcasting/advancements/aab_big_cast.json 4f4c94021adfb296e3ef3dce1acc46f724f38f92 data/hexcasting/advancements/aab_big_cast.json
a165e3959b7d0c37bea586d0e94609b483255569 data/hexcasting/advancements/enlightenment.json a165e3959b7d0c37bea586d0e94609b483255569 data/hexcasting/advancements/enlightenment.json
@ -262,9 +262,6 @@ eb17a23e7a9543f33922c056cdf0d63def176bf2 data/hexcasting/advancements/recipes/he
cfd93238a1774a30a9da7c6b84e66c2e1e22f243 data/hexcasting/advancements/recipes/hexcasting/wand.json cfd93238a1774a30a9da7c6b84e66c2e1e22f243 data/hexcasting/advancements/recipes/hexcasting/wand.json
d31956749bebbcb3f0d3c37f89b569642ac8c2fb data/hexcasting/advancements/root.json d31956749bebbcb3f0d3c37f89b569642ac8c2fb data/hexcasting/advancements/root.json
739cbdf7f204132f2acfab4df8d21c6197aa1456 data/hexcasting/advancements/y_u_no_cast_angy.json 739cbdf7f204132f2acfab4df8d21c6197aa1456 data/hexcasting/advancements/y_u_no_cast_angy.json
70a8f77d38affa642afbfceebe129358737b09ac data/hexcasting/loot_modifiers/amethyst_cluster_charged.json
f746acc6b3e798d3b95f4ceb463c648b1f3ae8c3 data/hexcasting/loot_modifiers/amethyst_cluster_dust.json
985be42281c0396c22b4976b8466448dccd716ec data/hexcasting/loot_modifiers/amethyst_cluster_shard_reducer.json
e04be385fa9daa422e41a38ddd70fdd065107968 data/hexcasting/loot_modifiers/scroll_bastion.json e04be385fa9daa422e41a38ddd70fdd065107968 data/hexcasting/loot_modifiers/scroll_bastion.json
6569766d1579114149eb0a1154d05ec3c964b2a3 data/hexcasting/loot_modifiers/scroll_cartographer.json 6569766d1579114149eb0a1154d05ec3c964b2a3 data/hexcasting/loot_modifiers/scroll_cartographer.json
afecba3144e00505977a4ab4de7940f949ab7818 data/hexcasting/loot_modifiers/scroll_dungeon.json afecba3144e00505977a4ab4de7940f949ab7818 data/hexcasting/loot_modifiers/scroll_dungeon.json
@ -348,6 +345,7 @@ d14cf2f8f0895a5b6dc09b7582c0abf1c2514adf data/hexcasting/recipes/sub_sandwich.js
67b16cdb26f40234a7d4e49357724f24c197580a data/hexcasting/recipes/trinket.json 67b16cdb26f40234a7d4e49357724f24c197580a data/hexcasting/recipes/trinket.json
14d6be5d47b54676a349564ea32c045c76c39b45 data/hexcasting/recipes/uuid_colorizer.json 14d6be5d47b54676a349564ea32c045c76c39b45 data/hexcasting/recipes/uuid_colorizer.json
0521d57838cb3e9795fc02ce47aa58db3b0188f9 data/hexcasting/recipes/wand.json 0521d57838cb3e9795fc02ce47aa58db3b0188f9 data/hexcasting/recipes/wand.json
a7965a0a1b78a7c6f7ebb06e219e8eaa2adb5cf5 data/minecraft/loot_tables/blocks/amethyst_cluster.json
f930dbc5b41d42150d388e39b29b940229658809 data/minecraft/tags/blocks/crystal_sound_blocks.json f930dbc5b41d42150d388e39b29b940229658809 data/minecraft/tags/blocks/crystal_sound_blocks.json
eb4bfbd7fc7632a5c16aa1d50d6090a1f466069b data/minecraft/tags/blocks/mineable/pickaxe.json eb4bfbd7fc7632a5c16aa1d50d6090a1f466069b data/minecraft/tags/blocks/mineable/pickaxe.json
f55afc2c05d93b5a44bc9fd73c5e81e71b183965 data/minecraft/tags/blocks/mineable/shovel.json f55afc2c05d93b5a44bc9fd73c5e81e71b183965 data/minecraft/tags/blocks/mineable/shovel.json

View file

@ -1,10 +1,7 @@
{ {
"replace": false, "replace": false,
"entries": [ "entries": [
"hexcasting:amethyst_cluster_charged",
"hexcasting:amethyst_cluster_shard_reducer",
"hexcasting:scroll_bastion", "hexcasting:scroll_bastion",
"hexcasting:amethyst_cluster_dust",
"hexcasting:scroll_dungeon", "hexcasting:scroll_dungeon",
"hexcasting:scroll_stronghold_library", "hexcasting:scroll_stronghold_library",
"hexcasting:scroll_jungle", "hexcasting:scroll_jungle",

View file

@ -1,41 +0,0 @@
{
"conditions": [
{
"condition": "forge:loot_table_id",
"loot_table_id": "minecraft:blocks/amethyst_cluster"
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch"
}
]
}
}
},
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.25,
0.35,
0.5,
0.75,
1.0
]
}
],
"item": "hexcasting:charged_amethyst",
"functions": [
{
"function": "minecraft:set_count",
"count": 1.0,
"add": false
}
],
"type": "paucal:add_item"
}

View file

@ -1,39 +0,0 @@
{
"conditions": [
{
"condition": "forge:loot_table_id",
"loot_table_id": "minecraft:blocks/amethyst_cluster"
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch"
}
]
}
}
}
],
"item": "hexcasting:amethyst_dust",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1.0,
"max": 4.0
},
"add": false
},
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops"
}
],
"type": "paucal:add_item"
}

View file

@ -1,30 +0,0 @@
{
"conditions": [
{
"condition": "forge:loot_table_id",
"loot_table_id": "minecraft:blocks/amethyst_cluster"
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch"
}
]
}
}
}
],
"item": "minecraft:amethyst_shard",
"functions": [
{
"function": "minecraft:set_count",
"count": -2.0,
"add": true
}
],
"type": "paucal:add_item"
}

View file

@ -0,0 +1,120 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "minecraft:amethyst_cluster"
},
{
"type": "minecraft:group",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"tag": "minecraft:cluster_max_harvestables"
}
}
],
"children": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1.0,
"max": 4.0
},
"add": false
},
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops"
}
],
"name": "hexcasting:amethyst_dust"
},
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0.0,
"max": 2.0
},
"add": false
},
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops"
}
],
"name": "minecraft:amethyst_shard"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.25,
0.35,
0.5,
0.75,
1.0
]
}
],
"name": "hexcasting:charged_amethyst"
}
]
},
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 0.0,
"max": 1.0
},
"add": false
}
],
"name": "minecraft:amethyst_shard"
}
]
}
]
}
]
}

View file

@ -62,6 +62,9 @@ class GuiSpellcasting(private val handOpenedWith: InteractionHand) : Screen(Text
} }
override fun init() { override fun init() {
val soundman = Minecraft.getInstance().soundManager
soundman.stop(HexSounds.CASTING_AMBIANCE.get().location, null)
this.ambianceSoundInstance = SimpleSoundInstance( this.ambianceSoundInstance = SimpleSoundInstance(
HexSounds.CASTING_AMBIANCE.get().location, HexSounds.CASTING_AMBIANCE.get().location,
SoundSource.PLAYERS, SoundSource.PLAYERS,

View file

@ -2,15 +2,30 @@ package at.petrak.hexcasting.datagen;
import at.petrak.hexcasting.common.blocks.HexBlocks; import at.petrak.hexcasting.common.blocks.HexBlocks;
import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate; import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate;
import at.petrak.hexcasting.common.items.HexItems;
import at.petrak.paucal.api.datagen.PaucalLootTableProvider; 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.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.AlternativesEntry;
import net.minecraft.world.level.storage.loot.entries.EntryGroup;
import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction; import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.predicates.BonusLevelTableCondition;
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.nbt.ContextNbtProvider;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import java.util.Map; import java.util.Map;
@ -36,5 +51,30 @@ public class HexLootTables extends PaucalLootTableProvider {
.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY) .apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY)
.copy(BlockEntitySlate.TAG_PATTERN, "BlockEntityTag." + BlockEntitySlate.TAG_PATTERN))); .copy(BlockEntitySlate.TAG_PATTERN, "BlockEntityTag." + BlockEntitySlate.TAG_PATTERN)));
lootTables.put(HexBlocks.SLATE.get(), LootTable.lootTable().withPool(slatePool)); lootTables.put(HexBlocks.SLATE.get(), LootTable.lootTable().withPool(slatePool));
// Just override the vanilla table
var amethystPool = LootPool.lootPool()
.setRolls(ConstantValue.exactly(1))
.add(AlternativesEntry.alternatives(
LootItem.lootTableItem(Items.AMETHYST_CLUSTER)
.when(MatchTool.toolMatches(ItemPredicate.Builder.item().hasEnchantment(
new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.atLeast(1))))),
EntryGroup.list(
LootItem.lootTableItem(HexItems.AMETHYST_DUST.get())
.apply(SetItemCountFunction.setCount(UniformGenerator.between(1, 4)))
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)),
LootItem.lootTableItem(Items.AMETHYST_SHARD)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(0, 2)))
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)),
LootItem.lootTableItem(HexItems.CHARGED_AMETHYST.get())
.when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE,
0.25f, 0.35f, 0.5f, 0.75f, 1.0f))
).when(MatchTool.toolMatches(ItemPredicate.Builder.item().of(ItemTags.CLUSTER_MAX_HARVESTABLES))),
LootItem.lootTableItem(Items.AMETHYST_SHARD)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(0, 1)))
));
lootTables.put(Blocks.AMETHYST_CLUSTER, LootTable.lootTable().withPool(amethystPool));
} }
} }

View file

@ -1,24 +1,9 @@
package at.petrak.hexcasting.datagen.lootmods; package at.petrak.hexcasting.datagen.lootmods;
import at.petrak.hexcasting.HexMod; import at.petrak.hexcasting.HexMod;
import at.petrak.hexcasting.common.items.HexItems;
import at.petrak.paucal.api.lootmod.PaucalAddItemModifier;
import at.petrak.paucal.api.lootmod.PaucalLootMods;
import net.minecraft.advancements.critereon.EnchantmentPredicate;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.world.level.storage.loot.functions.LootItemFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.predicates.BonusLevelTableCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.level.storage.loot.predicates.MatchTool;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraftforge.common.data.GlobalLootModifierProvider; import net.minecraftforge.common.data.GlobalLootModifierProvider;
import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
import net.minecraftforge.common.loot.LootTableIdCondition; import net.minecraftforge.common.loot.LootTableIdCondition;
@ -38,44 +23,6 @@ public class HexLootModifiers extends GlobalLootModifierProvider {
@Override @Override
protected void start() { protected void start() {
ResourceLocation amethystCluster = new ResourceLocation("minecraft:blocks/amethyst_cluster");
// 4? that's a lot!
add("amethyst_cluster_shard_reducer", PaucalLootMods.ADD_ITEM.get(), new PaucalAddItemModifier(
Items.AMETHYST_SHARD, new LootItemFunction[]{
SetItemCountFunction.setCount(ConstantValue.exactly(-2), true).build(),
}, new LootItemCondition[]{
LootTableIdCondition.builder(amethystCluster).build(),
MatchTool.toolMatches(
ItemPredicate.Builder.item().hasEnchantment(
new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.ANY)))
.invert().build(),
}
));
add("amethyst_cluster_dust", PaucalLootMods.ADD_ITEM.get(), new PaucalAddItemModifier(
HexItems.AMETHYST_DUST.get(), new LootItemFunction[]{
SetItemCountFunction.setCount(UniformGenerator.between(1, 4)).build(),
ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE).build()
}, new LootItemCondition[]{
LootTableIdCondition.builder(amethystCluster).build(),
MatchTool.toolMatches(
ItemPredicate.Builder.item().hasEnchantment(
new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.ANY)))
.invert().build(),
}
));
add("amethyst_cluster_charged", PaucalLootMods.ADD_ITEM.get(), new PaucalAddItemModifier(
HexItems.CHARGED_AMETHYST.get(), 1, new LootItemCondition[]{
LootTableIdCondition.builder(amethystCluster).build(),
MatchTool.toolMatches(
ItemPredicate.Builder.item().hasEnchantment(
new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.Ints.ANY)))
.invert().build(),
BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE,
0.25f, 0.35f, 0.5f, 0.75f, 1.0f).build()
}));
add("scroll_jungle", SCROLLS_IN_CHESTS.get(), new PatternScrollModifier(new LootItemCondition[]{ add("scroll_jungle", SCROLLS_IN_CHESTS.get(), new PatternScrollModifier(new LootItemCondition[]{
LootTableIdCondition.builder(new ResourceLocation("minecraft:chests/jungle_temple")).build() LootTableIdCondition.builder(new ResourceLocation("minecraft:chests/jungle_temple")).build()
}, 1.0)); }, 1.0));