Skip to content

Commit

Permalink
ok did i actually do it
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Oct 24, 2023
1 parent bbfd487 commit b10d06e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ What's new:
- Can climb up walls.
- Can be scooped up in Buckets.
- Will drop its Claw upon death, which can be cooked.
- Added the Reach Boost effect!
- Extends the player's reach by 0.75 per level.
- Does not affect attacking, only impacts interactions with Items and Blocks, including both placing and breaking.
- Fixed Jellyfish no longer spawning in Jellyfish Caves.
- Slightly optimized Rainbow Jellyfish rendering.
- Added a translation string for Coconut projectiles.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.frozenblock.wilderwild.mixin.entity.crab;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.frozenblock.wilderwild.registry.RegisterMobEffects;
import net.minecraft.server.level.ServerPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ServerGamePacketListenerImpl.class)
public class ServerGamePacketListenerImpl {

@Shadow
public ServerPlayer player;

@ModifyReturnValue(method = "handleUseItemOn", at = @At(value = "FIELD", target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;MAX_INTERACTION_DISTANCE:D"))
public double wilderWild$handleUseItemOn(double original) {
if (this.player != null && this.player.hasEffect(RegisterMobEffects.REACH)) {
int amplifier = this.player.getEffect(RegisterMobEffects.REACH).getAmplifier() + 1;
return original + (amplifier * 0.75D);
}
return original;
}

@ModifyReturnValue(method = "handleInteract", at = @At(value = "FIELD", target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;MAX_INTERACTION_DISTANCE:D"))
public double wilderWild$handleInteract(double original) {
if (this.player != null && this.player.hasEffect(RegisterMobEffects.REACH)) {
int amplifier = this.player.getEffect(RegisterMobEffects.REACH).getAmplifier() + 1;
return original + (amplifier * 0.75D);
}
return original;
}

}
1 change: 1 addition & 0 deletions src/main/resources/wilderwild.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"entity.boat.BoatDropsMixin",
"entity.boat.BoatTypeMixin",
"entity.boat.ChestBoatDropsMixin",
"entity.crab.ServerGamePacketListenerImpl",
"entity.crab.ServerPlayerGameModeMixin",
"entity.crab.VibrationSystemTickerMixin",
"entity.crab.WallClimberNavigationMixin",
Expand Down

0 comments on commit b10d06e

Please sign in to comment.