diff --git a/src/main/java/me/zeroeightsix/kami/mixin/client/MixinPlayerControllerMP.java b/src/main/java/me/zeroeightsix/kami/mixin/client/MixinPlayerControllerMP.java new file mode 100644 index 00000000..e0b406f7 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/mixin/client/MixinPlayerControllerMP.java @@ -0,0 +1,25 @@ +package me.zeroeightsix.kami.mixin.client; + +import me.zeroeightsix.kami.module.modules.player.TpsSync; +import me.zeroeightsix.kami.util.LagCompensator; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +/** + * Created by 086 on 3/10/2018. + */ +@Mixin(PlayerControllerMP.class) +public class MixinPlayerControllerMP { + + @Redirect(method = "onPlayerDamageBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getPlayerRelativeBlockHardness(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)F")) + float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) { + return state.getPlayerRelativeBlockHardness(player, worldIn, pos) * (TpsSync.isSync() ? (LagCompensator.INSTANCE.getTickRate() / 20f) : 1); + } + +} diff --git a/src/main/resources/mixins.kami.json b/src/main/resources/mixins.kami.json index 37ea9a0f..5e45c68e 100644 --- a/src/main/resources/mixins.kami.json +++ b/src/main/resources/mixins.kami.json @@ -20,6 +20,7 @@ "MixinGuiPlayerTabOverlay", "MixinC00Handshake", "MixinNetHandlerPlayClient", - "MixinRenderLiving" + "MixinRenderLiving", + "MixinPlayerControllerMP" ] }