From 149a0f80e665f59bbf213b3067398d50c67ba2eb Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Mon, 16 Oct 2023 08:44:15 +0100 Subject: [PATCH] Added worthy_potion --- .../c622617f6fabf890a00b9275cd5f643584a8a2c8 | 4 +-- .../assets/armourandtoolsmod/lang/en_us.json | 6 +++- .../armourandtoolsmod/ArmourAndToolsMod.kt | 1 + .../core/init/EnchantmentCategoryInit.kt | 26 ++++++++++++++ .../armourandtoolsmod/core/init/ItemInit.kt | 5 +++ .../core/init/PotionsInit.kt | 35 +++++++++++++++++++ .../core/material/CustomToolMaterial.kt | 3 +- .../datagen/lang/ModEnLangProvider.kt | 10 ++++++ .../enchantment/SkyForgeEnchantment.kt | 28 +++++++++++++++ 9 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/EnchantmentCategoryInit.kt create mode 100644 src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/PotionsInit.kt create mode 100644 src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/enchantment/SkyForgeEnchantment.kt diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 index a4874d9d..b6e29a7b 100644 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 @@ -1,2 +1,2 @@ -// 1.20.1 2023-10-12T22:09:59.3296691 Languages: en_us -8b0152e07cd1a1ee30bf67cc31642c7f52bea792 assets/armourandtoolsmod/lang/en_us.json +// 1.20.1 2023-10-16T08:43:51.7417297 Languages: en_us +e9fb8de4e52cfdc1f2fca0cb36fbfb0c1d6ca5ed assets/armourandtoolsmod/lang/en_us.json diff --git a/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json b/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json index 5028ba59..f2202f5b 100644 --- a/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json +++ b/src/generated/resources/assets/armourandtoolsmod/lang/en_us.json @@ -126,6 +126,7 @@ "item.armourandtoolsmod.imperium_pickaxe": "Imperium Pickaxe", "item.armourandtoolsmod.imperium_sword": "Imperium Sword", "item.armourandtoolsmod.magma_strike_pickaxe": "Magma Strike Pickaxe", + "item.armourandtoolsmod.mjolnir": "Mjölnir", "item.armourandtoolsmod.rainbow": "Rainbow Ingot", "item.armourandtoolsmod.rainbow_boots": "Rainbow Boots", "item.armourandtoolsmod.rainbow_chestplate": "Rainbow Chestplate", @@ -160,5 +161,8 @@ "item.armourandtoolsmod.sapphire_pickaxe": "Sapphire Pickaxe", "item.armourandtoolsmod.sapphire_shield": "Sapphire Shield", "item.armourandtoolsmod.sapphire_shovel": "Sapphire Shovel", - "item.armourandtoolsmod.sapphire_sword": "Sapphire Sword" + "item.armourandtoolsmod.sapphire_sword": "Sapphire Sword", + "item.minecraft.lingering_potion.effect.worthy_potion": "Worthy Potion", + "item.minecraft.potion.effect.worthy_potion": "Worthy Potion", + "item.minecraft.splash_potion.effect.worthy_potion": "Worthy Potion" } \ No newline at end of file diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt index c62c3741..eea10d58 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/ArmourAndToolsMod.kt @@ -44,6 +44,7 @@ class ArmourAndToolsMod { EntityTypeInit.ENTITY_TYPES.register(bus) BlockEntityTypeInit.BLOCK_ENTITY_TYPES.register(bus) CreativeModeTabInit.CREATIVE_MODE_TAB.register(bus) + PotionsInit.POTION.register(bus) // Register ourselves for server and other game events we are interested in // Register the data generators diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/EnchantmentCategoryInit.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/EnchantmentCategoryInit.kt new file mode 100644 index 00000000..d74253b3 --- /dev/null +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/EnchantmentCategoryInit.kt @@ -0,0 +1,26 @@ +/* + * Copyright 2023 RealYusufIsmail. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.realyusufismail.armourandtoolsmod.core.init + +import io.github.realyusufismail.armourandtoolsmod.items.hammer.HammerItem +import net.minecraft.world.item.enchantment.EnchantmentCategory + +object EnchantmentCategoryInit { + val HAMMER = EnchantmentCategory.create("hammer") { item -> item is HammerItem } +} diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/ItemInit.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/ItemInit.kt index 41308cd0..5d29db12 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/ItemInit.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/ItemInit.kt @@ -428,6 +428,11 @@ object ItemInit { HammerItem(CustomToolMaterial.DRAGON_DESTROYER, 1000, -3.6f, 10F, HammerLevel.LEGENDARY) } + val MJOLNIR: ObjectHolderDelegate = + ITEMS.registerObject("mjolnir") { + HammerItem(CustomToolMaterial.MJOLNIR, 10000, -3.6f, 10F, HammerLevel.GODLY) + } + // Tridents val AQUMARINE_TRIDENT: ObjectHolderDelegate = ITEMS.registerSmeltableObject("aqumarine_trident", AQUMARINE) { AqumarineTridentItem() } diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/PotionsInit.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/PotionsInit.kt new file mode 100644 index 00000000..9cf704e8 --- /dev/null +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/PotionsInit.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2023 RealYusufIsmail. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.realyusufismail.armourandtoolsmod.core.init + +import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod +import net.minecraft.world.item.alchemy.Potion +import net.minecraftforge.registries.DeferredRegister +import net.minecraftforge.registries.ForgeRegistries +import thedarkcolour.kotlinforforge.forge.ObjectHolderDelegate +import thedarkcolour.kotlinforforge.forge.registerObject + +object PotionsInit { + val POTION: DeferredRegister = + DeferredRegister.create(ForgeRegistries.POTIONS, ArmourAndToolsMod.MOD_ID) + + // WORTHY_POTION has no effect, it just an indication that the potion is worthy to use mjolnir + public val WORTHY_POTION: ObjectHolderDelegate = + POTION.registerObject("worthy_potion") { Potion() } +} diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/material/CustomToolMaterial.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/material/CustomToolMaterial.kt index 679596b4..31dbe9a5 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/material/CustomToolMaterial.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/material/CustomToolMaterial.kt @@ -52,7 +52,8 @@ enum class CustomToolMaterial( IMPERIUM_SWORD(6, 4000, 20, Supplier { Ingredient.of(ItemInit.IMPERIUM.get()) }), IMPERIUM_PICKAXE(6, 4000, 20, Supplier { Ingredient.of(ItemInit.IMPERIUM.get()) }), MAGMA_STRIKE_PICKAXE(6, 8000, 20, Supplier { Ingredient.of(ItemInit.IMPERIUM.get()) }), - DRAGON_DESTROYER(7, 10000, 25, Supplier { Ingredient.of(ItemInit.RUBY.get()) }); + DRAGON_DESTROYER(7, 10000, 25, Supplier { Ingredient.of(ItemInit.RUBY.get()) }), + MJOLNIR(10, 50000, 0, Supplier { Ingredient.of(ItemInit.RUBY.get()) }); private val harvestLevel = 0 private val maxUses = 0 diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/lang/ModEnLangProvider.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/lang/ModEnLangProvider.kt index e0284918..cdee9509 100644 --- a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/lang/ModEnLangProvider.kt +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/lang/ModEnLangProvider.kt @@ -135,6 +135,7 @@ class ModEnLangProvider(gen: DataGenerator) : ModEnLangProviderSupport(gen, MOD_ addItem(ItemInit.IMPERIUM_PICKAXE, "Imperium Pickaxe") addItem(ItemInit.MAGMA_STRIKE_PICKAXE, "Magma Strike Pickaxe") addItem(ItemInit.DRAGON_DESTROYER, "Dragon Destroyer") + addItem(ItemInit.MJOLNIR, "Mjölnir") // Shields addItem(ItemInit.RUBY_SHIELD, "Ruby Shield") @@ -146,6 +147,9 @@ class ModEnLangProvider(gen: DataGenerator) : ModEnLangProviderSupport(gen, MOD_ // Trident addItem(ItemInit.AQUMARINE_TRIDENT, "Aqumarine Trident") + // Potions + addPotion("worthy_potion", "Worthy Potion") + // others add("creativetab.armourandtoolsmod", "Armour and Item Mod") add("container.custom_armour_crafting_table", "Armour Crafting Table") @@ -301,4 +305,10 @@ class ModEnLangProvider(gen: DataGenerator) : ModEnLangProviderSupport(gen, MOD_ add(Component.translatable("advancements.$MOD_ID.$advancement.title"), title) add(Component.translatable("advancements.$MOD_ID.$advancement.description"), description) } + + private fun addPotion(object_name: String, name: String) { + add(Component.translatable("item.minecraft.potion.effect.$object_name"), name) + add(Component.translatable("item.minecraft.splash_potion.effect.$object_name"), name) + add(Component.translatable("item.minecraft.lingering_potion.effect.$object_name"), name) + } } diff --git a/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/enchantment/SkyForgeEnchantment.kt b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/enchantment/SkyForgeEnchantment.kt new file mode 100644 index 00000000..4d8c8cc6 --- /dev/null +++ b/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/enchantment/SkyForgeEnchantment.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2023 RealYusufIsmail. + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.realyusufismail.armourandtoolsmod.enchantment + +import io.github.realyusufismail.armourandtoolsmod.core.init.EnchantmentCategoryInit +import net.minecraft.world.entity.EquipmentSlot +import net.minecraft.world.item.enchantment.Enchantment + +/** Once applied to a hammer gives you the ability to fly. */ +class SkyForgeEnchantment : + Enchantment( + Rarity.VERY_RARE, EnchantmentCategoryInit.HAMMER, arrayOf(EquipmentSlot.MAINHAND)) {}