diff --git a/.gitignore b/.gitignore index 2ff9efb8..b103de6c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,10 @@ # Minecraft client/server files run/ run-data/ +neoforge/runs +neoforge/run-data +forge/runs +forge/run-data ### Intellij+all ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider diff --git a/forge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/advancment/Advancements.kt b/forge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/advancment/Advancements.kt index 604e0128..00971656 100644 --- a/forge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/advancment/Advancements.kt +++ b/forge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/datagen/advancment/Advancements.kt @@ -40,36 +40,6 @@ import net.minecraftforge.common.data.ExistingFileHelper import net.minecraftforge.common.data.ForgeAdvancementProvider class Advancements : ForgeAdvancementProvider.AdvancementGenerator { - private fun simpleGetItem( - consumer: Consumer, - item: ItemLike, - parent: Advancement - ): Advancement { - return simpleGetItem(consumer, item, parent, item.asItem().toString()) - } - - private fun simpleGetItem( - consumer: Consumer, - item: ItemLike, - parent: Advancement, - key: String - ): Advancement { - return simpleGetItem(consumer, item, ItemStack(item), parent, key) - } - - private fun simpleGetItem( - consumer: Consumer, - item: ItemLike, - icon: ItemStack, - parent: Advancement, - key: String - ): Advancement { - return Advancement.Builder.advancement() - .parent(parent) - .display(icon, title(key), description(key), null, FrameType.TASK, true, true, false) - .addCriterion("get_item", getItem(item)) - .save(consumer, id(key)) - } private fun id(path: String): String { return ArmourAndToolsMod.getModIdAndName(path).toString() diff --git a/neoforge/CHANGELOG.md b/neoforge/CHANGELOG.md index cbea2123..aaa69ca5 100644 --- a/neoforge/CHANGELOG.md +++ b/neoforge/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. # [1.20.2-2.0.0.beta3] - UNRELEASED # Updated json files to reflect Neo Forges changes. +# Identified issue with trident not being able to be thrown. Will be fixed in future. # [1.20.2-2.0.0.beta2] - 2023-11-13 diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties index bedf478d..a782a18c 100644 --- a/neoforge/gradle.properties +++ b/neoforge/gradle.properties @@ -7,7 +7,7 @@ mcVersion = 1.20.2 projectId = 480779 modId = armourandtoolsmod -neoForgeVersion = 20.2.35-beta +neoForgeVersion = 20.2.51-beta kotlinForForgeVersion = 4.6.1 logbackVersion = 1.4.11 junitVersion = 5.10.0 diff --git a/neoforge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/items/trident/ArmourToolsModTridentItem.kt b/neoforge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/items/trident/ArmourToolsModTridentItem.kt index 481ef77c..1d403134 100644 --- a/neoforge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/items/trident/ArmourToolsModTridentItem.kt +++ b/neoforge/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/items/trident/ArmourToolsModTridentItem.kt @@ -37,6 +37,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraft.world.entity.ai.attributes.Attributes import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.projectile.AbstractArrow +import net.minecraft.world.entity.projectile.ThrownTrident import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Tier import net.minecraft.world.item.TridentItem @@ -94,12 +95,7 @@ abstract class ArmourToolsModTridentItem( } /** Called when the player stops using an Item (stops holding the right mouse button). */ - override fun releaseUsing( - pStack: ItemStack, - pLevel: Level, - pEntityLiving: LivingEntity, - pTimeLeft: Int - ) { + override fun releaseUsing(pStack: ItemStack, pLevel: Level, pEntityLiving: LivingEntity, pTimeLeft: Int) { if (pEntityLiving is Player) { val i = getUseDuration(pStack) - pTimeLeft if (i >= 10) { @@ -110,25 +106,27 @@ abstract class ArmourToolsModTridentItem( p_43388_.broadcastBreakEvent(pEntityLiving.getUsedItemHand()) } if (j == 0) { - val throwntrident = getThrownEntity(pLevel, pEntityLiving, pStack) - throwntrident.shootFromRotation( + val thrownTrident = ThrownTrident(pLevel, pEntityLiving, pStack) + thrownTrident.shootFromRotation( pEntityLiving, - pEntityLiving.getXRot(), - pEntityLiving.getYRot(), + pEntityLiving.xRot, + pEntityLiving.yRot, 0.0f, 2.5f + j.toFloat() * 0.5f, - 1.0f) + 1.0f + ) if (pEntityLiving.abilities.instabuild) { - throwntrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY + thrownTrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY } - pLevel.addFreshEntity(throwntrident) + pLevel.addFreshEntity(thrownTrident) pLevel.playSound( - null as Player?, - throwntrident, + null, + thrownTrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0f, - 1.0f) + 1.0f + ) if (!pEntityLiving.abilities.instabuild) { pEntityLiving.inventory.removeItem(pStack) } @@ -136,15 +134,15 @@ abstract class ArmourToolsModTridentItem( } pEntityLiving.awardStat(Stats.ITEM_USED[this]) if (j > 0) { - val f7 = pEntityLiving.getYRot() - val f = pEntityLiving.getXRot() + val f7 = pEntityLiving.yRot + val f = pEntityLiving.xRot var f1 = -Mth.sin(f7 * (Math.PI.toFloat() / 180f)) * - Mth.cos(f * (Math.PI.toFloat() / 180f)) + Mth.cos(f * (Math.PI.toFloat() / 180f)) var f2 = -Mth.sin(f * (Math.PI.toFloat() / 180f)) var f3 = Mth.cos(f7 * (Math.PI.toFloat() / 180f)) * - Mth.cos(f * (Math.PI.toFloat() / 180f)) + Mth.cos(f * (Math.PI.toFloat() / 180f)) val f4 = Mth.sqrt(f1 * f1 + f2 * f2 + f3 * f3) val f5 = 3.0f * ((1.0f + j.toFloat()) / 4.0f) f1 *= f5 / f4 @@ -156,7 +154,7 @@ abstract class ArmourToolsModTridentItem( val f6 = 1.1999999f pEntityLiving.move(MoverType.SELF, Vec3(0.0, f6.toDouble(), 0.0)) } - val soundevent: SoundEvent = + val soundEvent: SoundEvent = if (j >= 3) { SoundEvents.TRIDENT_RIPTIDE_3 } else if (j == 2) { @@ -165,45 +163,32 @@ abstract class ArmourToolsModTridentItem( SoundEvents.TRIDENT_RIPTIDE_1 } pLevel.playSound( - null as Player?, + null, pEntityLiving, - soundevent, + soundEvent, SoundSource.PLAYERS, 1.0f, - 1.0f) + 1.0f + ) } } } } } - /** - * Called to trigger the item's "innate" right click behavior. To handle when this item is used - * on a Block, see [.onItemUse]. - */ - override fun use( - pLevel: Level, - pPlayer: Player, - hand: InteractionHand - ): InteractionResultHolder { - val itemStack: ItemStack = pPlayer.getItemInHand(hand) - return if (itemStack.damageValue >= itemStack.maxDamage - 1) { - InteractionResultHolder.fail(itemStack) - } else if (!requiresRainForRiptide()) { - pPlayer.startUsingItem(hand) - InteractionResultHolder.consume(itemStack) - } else if (EnchantmentHelper.getRiptide(itemStack) > 0 && !pPlayer.isInWaterOrRain) { - InteractionResultHolder.fail(itemStack) + + override fun use(p_43405_: Level, p_43406_: Player, p_43407_: InteractionHand): InteractionResultHolder { + val itemstack = p_43406_.getItemInHand(p_43407_) + return if (itemstack.damageValue >= itemstack.maxDamage - 1) { + InteractionResultHolder.fail(itemstack) + } else if (EnchantmentHelper.getRiptide(itemstack) > 0 && !p_43406_.isInWaterOrRain) { + InteractionResultHolder.fail(itemstack) } else { - pPlayer.startUsingItem(hand) - InteractionResultHolder.consume(itemStack) + p_43406_.startUsingItem(p_43407_) + InteractionResultHolder.consume(itemstack) } } - fun requiresRainForRiptide(): Boolean { - return true - } - /** * Current implementations of this method in child classes do not use the entry argument beside * ev. They just raise the damage on the stack. diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml index c412ed34..add9c7f7 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ license = "Apache 2.0" #mandatory issueTrackerURL = "https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/issues" [[mods]] modId = "armourandtoolsmod" -version = "1.20.2-1.0.0.beta2" +version = "1.20.2-1.0.0.beta3" displayName = "Armour and Tools Mod" logoFile = "logo.png" updateJSONURL = "https://forge.curseupdate.com/480779/armourandtoolsmod"