Skip to content

Commit

Permalink
hydrothermal vent + tube sponge should be silk-touchable now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Khar committed Dec 4, 2023
1 parent 8e6eade commit 9286c1f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:loot_table",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"tag": "minecraft:pickaxes"
}
}
],
"name": "hybrid-aquatic:gameplay/hydrothermal_vent_treasure"
},
{
"type": "minecraft:item",
"conditions": [
Expand All @@ -37,6 +25,10 @@
}
],
"name": "hybrid-aquatic:hydrothermal_vent"
},
{
"type": "minecraft:loot_table",
"name": "hybrid-aquatic:gameplay/hydrothermal_vent_treasure"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,6 @@
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:loot_table",
"conditions": [
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:any_of",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"items": [
"minecraft:shears"
]
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
}
],
"name": "hybrid-aquatic:gameplay/tube_sponge_drops"
},
{
"type": "minecraft:item",
"conditions": [
Expand All @@ -60,6 +25,10 @@
}
],
"name": "hybrid-aquatic:tube_sponge"
},
{
"type": "minecraft:loot_table",
"name": "hybrid-aquatic:gameplay/tube_sponge_drops"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,67 +26,53 @@ class BlockLootTableProvider(output: FabricDataOutput) : FabricBlockLootTablePro
override fun generate() {
// anemone
addDrop(HybridAquaticBlocks.ANEMONE) { block ->
LootTable.builder()
.pool(
LootPool.builder()
.with(ItemEntry.builder(block))
.conditionally(WITH_SILK_TOUCH_OR_SHEARS)
)
LootTable.builder().pool(
LootPool.builder()
.with(ItemEntry.builder(block))
.conditionally(WITH_SILK_TOUCH_OR_SHEARS)
)
}

// living sponge
addDrop(HybridAquaticBlocks.TUBE_SPONGE) { block ->
LootTable.builder().pool(
LootPool.builder().with(
AlternativeEntry.builder(
ItemEntry.builder(block).conditionally(WITH_SILK_TOUCH),
LootTableEntry.builder(HybridAquaticLootTables.TUBE_SPONGE_LOOT_ID)
.conditionally(
WITHOUT_SILK_TOUCH_NOR_SHEARS)
,
ItemEntry.builder(block)
.conditionally(WITH_SILK_TOUCH),
)
))
)
)
}

// hydrothermal vent
addDrop(HybridAquaticBlocks.HYDROTHERMAL_VENT) { block ->
LootTable.builder().pool(
LootPool.builder().with(
AlternativeEntry.builder(
ItemEntry.builder(block).conditionally(WITH_SILK_TOUCH),
LootTableEntry.builder(HybridAquaticLootTables.HYDROTHERMAL_VENT_LOOT_ID)
.conditionally(
MatchToolLootCondition.builder(
ItemPredicate.Builder.create()
.tag(ItemTags.PICKAXES)
)
),
ItemEntry.builder(block)
.conditionally(WITH_SILK_TOUCH),
)
))
)
)
}

// message in a bottle
addDrop(HybridAquaticBlocks.MESSAGE_IN_A_BOTTLE) { block ->
LootTable.builder()
.pool(
LootPool.builder()
.with(
LootTable.builder().pool(
LootPool.builder().with(
AlternativeEntry.builder(
ItemEntry.builder(block).conditionally(WITH_SILK_TOUCH)
.apply(
CopyNbtLootFunction.builder(ContextLootNbtProvider.BLOCK_ENTITY)
.withOperation(VARIANT_KEY, "$BLOCK_ENTITY_TAG_KEY.$VARIANT_KEY")
.withOperation(MESSAGE_KEY, "$BLOCK_ENTITY_TAG_KEY.$MESSAGE_KEY")
),
ItemEntry.builder(Items.WRITTEN_BOOK)
.apply(
CopyNbtLootFunction.builder(ContextLootNbtProvider.BLOCK_ENTITY)
.withOperation("$MESSAGE_KEY.tag.$PAGES_KEY", PAGES_KEY)
.withOperation("$MESSAGE_KEY.tag.$TITLE_KEY", TITLE_KEY)
.withOperation("$MESSAGE_KEY.tag.$AUTHOR_KEY", AUTHOR_KEY)
)
ItemEntry.builder(block).conditionally(WITH_SILK_TOUCH).apply(
CopyNbtLootFunction.builder(ContextLootNbtProvider.BLOCK_ENTITY)
.withOperation(VARIANT_KEY, "$BLOCK_ENTITY_TAG_KEY.$VARIANT_KEY")
.withOperation(MESSAGE_KEY, "$BLOCK_ENTITY_TAG_KEY.$MESSAGE_KEY")
),
ItemEntry.builder(Items.WRITTEN_BOOK).apply(
CopyNbtLootFunction.builder(ContextLootNbtProvider.BLOCK_ENTITY)
.withOperation("$MESSAGE_KEY.tag.$PAGES_KEY", PAGES_KEY)
.withOperation("$MESSAGE_KEY.tag.$TITLE_KEY", TITLE_KEY)
.withOperation("$MESSAGE_KEY.tag.$AUTHOR_KEY", AUTHOR_KEY)
)
)
)
)
Expand All @@ -97,16 +83,13 @@ class BlockLootTableProvider(output: FabricDataOutput) : FabricBlockLootTablePro
LootTable.builder().pool(
LootPool.builder().with(
AlternativeEntry.builder(
LootTableEntry.builder(HybridAquaticLootTables.CRATE_TREASURE_ID)
.conditionally(
MatchToolLootCondition.builder(
ItemPredicate.Builder.create()
.tag(ItemTags.AXES)
)
),
LootTableEntry.builder(HybridAquaticLootTables.CRATE_TREASURE_ID).conditionally(
MatchToolLootCondition.builder(ItemPredicate.Builder.create().tag(ItemTags.AXES))
),
ItemEntry.builder(block),
)
))
)
)
}

// generate remaining drops
Expand Down

0 comments on commit 9286c1f

Please sign in to comment.