Skip to content

Commit

Permalink
fix enchantment not tradeable in >=1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
btwonion committed Aug 1, 2024
1 parent 30f2d4c commit 58b6986
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- fix translations
- fix enchantment not tradeable in >=1.20.6
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import net.minecraft.core.HolderLookup
import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey
import net.minecraft.world.entity.EquipmentSlotGroup
import net.minecraft.world.item.enchantment.Enchantment
import net.minecraft.world.item.enchantment.Enchantment.EnchantmentDefinition
Expand All @@ -34,7 +35,15 @@ private class TelekinesisEnchantmentTagProvider(
output: FabricDataOutput, completableFuture: CompletableFuture<HolderLookup.Provider>
) : EnchantmentTagProvider(output, completableFuture) {
override fun addTags(registries: HolderLookup.Provider) {
getOrCreateTagBuilder(telekinesisEffectId).addOptional(telekinesisEnchantmentId)
fun minecraftTagKey(value: String): TagKey<Enchantment> = TagKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath("minecraft", value))
listOf(
getOrCreateTagBuilder(telekinesisEffectId),
getOrCreateTagBuilder(minecraftTagKey("tradeable")),
getOrCreateTagBuilder(minecraftTagKey("treasure")),
getOrCreateTagBuilder(minecraftTagKey("in_enchanting_table"))
).forEach {
it.add(telekinesisEnchantmentId)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
{
"id": "telekinesis:telekinesis",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
{
"id": "telekinesis:telekinesis",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
{
"id": "telekinesis:telekinesis",
"required": false
}
]
}

0 comments on commit 58b6986

Please sign in to comment.