Skip to content

Commit

Permalink
still having issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail committed Nov 13, 2023
1 parent cdcc370 commit edc73d0
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 79 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Advancement>,
item: ItemLike,
parent: Advancement
): Advancement {
return simpleGetItem(consumer, item, parent, item.asItem().toString())
}

private fun simpleGetItem(
consumer: Consumer<Advancement>,
item: ItemLike,
parent: Advancement,
key: String
): Advancement {
return simpleGetItem(consumer, item, ItemStack(item), parent, key)
}

private fun simpleGetItem(
consumer: Consumer<Advancement>,
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()
Expand Down
1 change: 1 addition & 0 deletions neoforge/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion neoforge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -110,41 +106,43 @@ 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)
}
}
}
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
Expand All @@ -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) {
Expand All @@ -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<ItemStack> {
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<ItemStack> {
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.
Expand Down
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit edc73d0

Please sign in to comment.