Skip to content

Commit

Permalink
extended reach when holding crab claw(hope it works)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Khar committed Jan 18, 2024
1 parent 4480264 commit b716ae8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"
modImplementation "net.fabricmc:fabric-language-kotlin:$fabric_kotlin_version"

annotationProcessor include (implementation("com.github.LlamaLad7:MixinExtras:$mixin_extras_version"))
include(implementation(annotationProcessor("com.github.LlamaLad7:MixinExtras:$mixin_extras_version")))

modImplementation "software.bernie.geckolib:geckolib-fabric-$geckolib_version"
modImplementation "com.terraformersmc:modmenu:$mod_menu_version"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.hybridlabs.aquatic.mixin.client;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import dev.hybridlabs.aquatic.item.HybridAquaticItems;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ClientPlayerInteractionManager.class)
public class ClientPlayerInteractionManagerMixin {
@Shadow @Final private MinecraftClient client;

@ModifyReturnValue(
method = "hasExtendedReach",
at = @At("RETURN")
)
private boolean extendedReachWithCrabClaw(boolean original) {
if(client.player == null) return original;

ItemStack offhandItem = client.player.getOffHandStack();
return original || (!offhandItem.isEmpty() & offhandItem.getItem().equals(HybridAquaticItems.INSTANCE.getCRAB_CLAW()));
}
}
1 change: 1 addition & 0 deletions src/client/resources/hybrid-aquatic.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compatibilityLevel": "JAVA_17",
"client": [
"BackgroundRendererMixin",
"ClientPlayerInteractionManagerMixin",
"FishingBobberEntityRendererMixin",
"HeadFeatureRendererMixin",
"SkullBlockEntityRendererMixin",
Expand Down

0 comments on commit b716ae8

Please sign in to comment.