Implement TpsSync

This commit is contained in:
zeroeightsix 2018-10-03 15:05:26 +02:00
parent 63036c8712
commit ab6e3c904b
2 changed files with 27 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -20,6 +20,7 @@
"MixinGuiPlayerTabOverlay",
"MixinC00Handshake",
"MixinNetHandlerPlayClient",
"MixinRenderLiving"
"MixinRenderLiving",
"MixinPlayerControllerMP"
]
}