- Выберите загрузчик игры
- Vanilla
- Forge
- Fabric
- NeoForge
- OptiFine
- ForgeOptiFine
- Прочие моды
всем ку югейм,переписал это под 3.1
Longjump.java:
package REJER.functions.impl.movement;
import REJER.events.EventPacket;
import REJER.events.EventUpdate;
import REJER.events.MovingEvent;
import com.google.common.eventbus.Subscribe;
import REJER.events.*;
import REJER.functions.api.Category;
import REJER.functions.api.Function;
import REJER.functions.api.FunctionRegister;
import REJER.functions.settings.impl.ModeSetting;
import REJER.utils.math.StopWatch;
import REJER.utils.player.InventoryUtil;
import REJER.utils.player.MouseUtil;
import REJER.utils.player.MoveUtils;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.entity.Pose;
import net.minecraft.network.play.server.SPlayerPositionLookPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import java.util.ArrayList;
import java.util.List;
@FunctionRegister(name = "LongJump", type = Category.Movement)
public class LongJump extends Function {
boolean placed;
int counter;
public ModeSetting mod = new ModeSetting("Мод", "Slap", "Slap", "Shulker");
public LongJump() {
addSettings(mod);
}
StopWatch stopWatch = new StopWatch();
@Subscribe
public void onUpdate(EventUpdate e) {
if (mod.is("Slap") && !mc.player.isInWater()) {
int slot = InventoryUtil.getSlotInInventoryOrHotbar();
if (slot == -1) {
print("У вас нет полублоков в хотбаре!");
toggle();
return;
}
int old = mc.player.inventory.currentItem;
if (MouseUtil.rayTraceResult(2, mc.player.rotationYaw, 90, mc.player) instanceof BlockRayTraceResult result) {
if (MoveUtils.isMoving()) {
if (mc.player.fallDistance >= 0.8 && mc.world.getBlockState(mc.player.getPosition()).isAir() && !mc.world.getBlockState(result.getPos()).isAir() && mc.world.getBlockState(result.getPos()).isSolid() && !(mc.world.getBlockState(result.getPos()).getBlock() instanceof SlabBlock) && !(mc.world.getBlockState(result.getPos()).getBlock() instanceof StairsBlock)) {
mc.player.inventory.currentItem = slot;
placed = true;
mc.playerController.processRightClickBlock(mc.player, mc.world, Hand.MAIN_HAND, result);
mc.player.inventory.currentItem = old;
mc.player.fallDistance = 0;
}
mc.gameSettings.keyBindJump.pressed = false;
if ((mc.player.isOnGround() && !mc.gameSettings.keyBindJump.pressed)
&& placed
&& mc.world.getBlockState(mc.player.getPosition()).isAir()
&& !mc.world.getBlockState(result.getPos()).isAir()
&& mc.world.getBlockState(result.getPos()).isSolid()
&& !(mc.world.getBlockState(result.getPos()).getBlock() instanceof SlabBlock) && stopWatch.isReached(750)) {
mc.player.setPose(Pose.STANDING);
stopWatch.reset();
placed = false;
} else if ((mc.player.isOnGround() && !mc.gameSettings.keyBindJump.pressed)) {
mc.player.jump();
placed = false;
}
}
} else {
if ((mc.player.isOnGround() && !mc.gameSettings.keyBindJump.pressed)) {
mc.player.jump();
placed = false;
}
}
}
else if (mod.is("Shulker") && !mc.player.isInWater()) {
for (BlockPos pos : getCube(mc.player.getPosition(), 2, 2)) {
if (mc.world.getBlockState(pos).getBlock() instanceof ShulkerBoxBlock &&
mc.player.movementInput.moveForward > 0 &&
mc.player.isSprinting()) {
mc.player.jumpMovementFactor = 0.2f;
break;
}
}
}
}
public static List<BlockPos> getCube(final BlockPos center, final float radiusXZ, final float radiusY) {
List<BlockPos> positions = new ArrayList<>();
int centerX = center.getX();
int centerY = center.getY();
int centerZ = center.getZ();
for (int x = centerX - (int) radiusXZ; x <= centerX + radiusXZ; x++) {
for (int z = centerZ - (int) radiusXZ; z <= centerZ + radiusXZ; z++) {
for (int y = centerY - (int) radiusY; y < centerY + radiusY; y++) {
positions.add(new BlockPos(x, y, z));
}
}
}
return positions;
}
@Subscribe
public void onMoving(MovingEvent e) {
}
@Subscribe
public void onFlag(EventPacket e) {
if (e.getPacket() instanceof SPlayerPositionLookPacket p) {
placed = false;
counter = 0;
mc.player.setPose(Pose.STANDING);
}
}
@Override
public boolean onEnable() {
super.onEnable();
counter = 0;
placed = false;
return false;
}
}