diff --git a/.gitignore b/.gitignore index 3b357db..5084f9e 100644 --- a/.gitignore +++ b/.gitignore @@ -142,4 +142,7 @@ server/* build/ .gradle/ +.env +*.env + # End of https://www.toptal.com/developers/gitignore/api/intellij+all,maven,java \ No newline at end of file diff --git a/VERSION b/VERSION index ab67981..a5ba932 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.6 \ No newline at end of file +1.1.7 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9680ee5..b9f3ebd 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,26 @@ plugins { id 'idea' id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' id 'org.parchmentmc.librarian.forgegradle' version '1.+' + id "com.modrinth.minotaur" version "2.+" +} + +modrinth { + token = System.getenv("MODRINTH_TOKEN") // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private! + projectId = "justleveling-fork" // This can be the project ID or the slug. Either will work! + versionNumber = "1.1.7" // You don't need to set this manually. Will fail if Modrinth has this version already + versionType = "release" // This is the default -- can also be `beta` or `alpha` + uploadFile = jar // With Loom, this MUST be set to `remapJar` instead of `jar`! + gameVersions = ["1.20.1"] // Must be an array, even with only one version + loaders = ["forge"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle + dependencies { // A special DSL for creating dependencies + // scope.type + // The scope can be `required`, `optional`, `incompatible`, or `embedded` + // The type can either be `project` or `version` + required.project "curios" // Creates a new required dependency on Fabric API + required.project "cloth-config" + + optional.version "yacl", "3.4.2+1.20.1-forge" // Creates a new optional dependency on this specific version of Sodium + } } apply plugin: 'org.spongepowered.mixin' diff --git a/gradle.properties b/gradle.properties index aeb2c03..485ff37 100644 --- a/gradle.properties +++ b/gradle.properties @@ -52,7 +52,7 @@ mod_name=JustLevelingFork # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=APACHE # The mod version. See https://semver.org/ -mod_version=1.1.6 +mod_version=1.1.7 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/com/seniors/justlevelingfork/mixin/MixTargetFinder.java b/src/main/java/com/seniors/justlevelingfork/mixin/MixTargetFinder.java index 39ffe17..68f2dd1 100644 --- a/src/main/java/com/seniors/justlevelingfork/mixin/MixTargetFinder.java +++ b/src/main/java/com/seniors/justlevelingfork/mixin/MixTargetFinder.java @@ -6,6 +6,8 @@ import net.bettercombat.client.collision.TargetFinder; import net.bettercombat.client.collision.WeaponHitBoxes; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.ForgeMod; @@ -25,17 +27,26 @@ public abstract class MixTargetFinder { @Inject(method = {"findAttackTargetResult"}, at = {@At("HEAD")}, cancellable = true, remap = false) private static void findAttackTargetResult(Player player, Entity cursorTarget, WeaponAttributes.Attack attack, double attackRange, CallbackInfoReturnable info) { - if(player == null || cursorTarget == null){ + if(player == null || cursorTarget == null || !ForgeMod.ENTITY_REACH.isPresent()){ return; } - info.cancel(); Vec3 origin = TargetFinder.getInitialTracingPoint(player); List entities = TargetFinder.getInitialTargets(player, cursorTarget, attackRange); if (!AttackRangeExtensions.sources().isEmpty()) { attackRange = apply$AttackRangeModifiers(player, attackRange); } - attackRange += Objects.requireNonNull(Objects.requireNonNull(player.getAttribute(ForgeMod.ENTITY_REACH.get())).getModifier(UUID.fromString("96a891fe-5919-418d-8205-f50464391509"))).getAmount(); + AttributeInstance playerReach = player.getAttribute(ForgeMod.ENTITY_REACH.get()); + if (playerReach == null) { + return; + } + AttributeModifier modifier = playerReach.getModifier(UUID.fromString("96a891fe-5919-418d-8205-f50464391509")); + if (modifier == null){ + return; + } + info.cancel(); + + attackRange += modifier.getAmount(); // Quality equipment directly changes the register function through reflection. // So I need to "replicate" what the reflection does here.