mirror of https://github.com/kami-blue/client
Add scaffold towering
This commit is contained in:
parent
454dc66303
commit
60614c7bce
|
@ -10,6 +10,7 @@ import me.zeroeightsix.kami.util.Wrapper;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockFalling;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.client.CPacketEntityAction;
|
||||
|
@ -35,6 +36,7 @@ import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
|
|||
public class Scaffold extends Module {
|
||||
|
||||
private Setting<Boolean> placeBlocks = register(Settings.b("Place Blocks", true));
|
||||
private Setting<Boolean> tower = register(Settings.b("Tower", false));
|
||||
private Setting<Mode> modeSetting = register(Settings.enumBuilder(Mode.class).withName("Mode").withValue(Mode.LEGIT).build());
|
||||
private Setting<Boolean> randomDelay = register(Settings.booleanBuilder("Random Delay").withValue(false).withVisibility(v -> modeSetting.getValue().equals(Mode.LEGIT)).build());
|
||||
private Setting<Integer> delayRange = register(Settings.integerBuilder("Delay Range").withMinimum(0).withValue(6).withMaximum(10).withVisibility(v -> modeSetting.getValue().equals(Mode.LEGIT) && randomDelay.getValue()).build());
|
||||
|
@ -42,6 +44,8 @@ public class Scaffold extends Module {
|
|||
|
||||
private boolean shouldSlow = false;
|
||||
|
||||
private double towerStart = 0.0;
|
||||
|
||||
private static Scaffold INSTANCE;
|
||||
|
||||
public Scaffold() {
|
||||
|
@ -74,6 +78,7 @@ public class Scaffold extends Module {
|
|||
public void onUpdate() {
|
||||
if (mc.player == null || MODULE_MANAGER.isModuleEnabled(Freecam.class)) return;
|
||||
shouldSlow = false;
|
||||
boolean towering = mc.gameSettings.keyBindJump.isKeyDown() && tower.getValue();
|
||||
|
||||
Vec3d vec3d = EntityUtil.getInterpolatedPos(mc.player, ticks.getValue());
|
||||
if (modeSetting.getValue().equals(Mode.LEGIT)) vec3d = EntityUtil.getInterpolatedPos(mc.player, 0);
|
||||
|
@ -84,12 +89,18 @@ public class Scaffold extends Module {
|
|||
|
||||
/* when legitBridge is enabled */
|
||||
/* check if block behind player is air or other replaceable block and if it is, make the player crouch */
|
||||
if (modeSetting.getValue().equals(Mode.LEGIT) && Wrapper.getWorld().getBlockState(legitPos.down()).getMaterial().isReplaceable() && mc.player.onGround) {
|
||||
if (modeSetting.getValue().equals(Mode.LEGIT) && Wrapper.getWorld().getBlockState(legitPos.down()).getMaterial().isReplaceable() && mc.player.onGround && !towering) {
|
||||
shouldSlow = true;
|
||||
mc.player.movementInput.sneak = true;
|
||||
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.START_SNEAKING));
|
||||
}
|
||||
|
||||
if(towering) {
|
||||
if (!(mc.player.posY > blockPos.y + 1.0f)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if block is already placed */
|
||||
if (!Wrapper.getWorld().getBlockState(blockPos).getMaterial().isReplaceable()) {
|
||||
return;
|
||||
|
@ -102,8 +113,28 @@ public class Scaffold extends Module {
|
|||
|
||||
/* place the block */
|
||||
if (placeBlocks.getValue()) placeBlockScaffold(blockPos);
|
||||
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.STOP_SNEAKING));
|
||||
shouldSlow = false;
|
||||
|
||||
|
||||
if(towering) {
|
||||
final double motion = 0.42d; // jump motion
|
||||
if(mc.player.onGround) {
|
||||
towerStart = mc.player.posY;
|
||||
mc.player.motionY = motion;
|
||||
}
|
||||
|
||||
if(mc.player.posY > towerStart + motion) {
|
||||
mc.player.setPosition(mc.player.posX, (int)mc.player.posY, mc.player.posZ);
|
||||
mc.player.motionY = motion;
|
||||
jumpGround = mc.player.posY;
|
||||
}
|
||||
} else {
|
||||
towerStart = 0.0;
|
||||
}
|
||||
|
||||
if(shouldSlow) {
|
||||
mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, Action.STOP_SNEAKING));
|
||||
shouldSlow = false;
|
||||
}
|
||||
}
|
||||
|
||||
private float getRandomInRange() {
|
||||
|
|
Loading…
Reference in New Issue