package org.dripless.client.managers.module.impl.movement;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import org.dripless.client.api.events.orbit.EventHandler;
import org.dripless.client.managers.events.player.MoveEvent;
import org.dripless.client.managers.events.player.UpdateEvent;
import org.dripless.client.managers.module.Category;
import org.dripless.client.managers.module.Module;
import org.dripless.client.managers.module.ModuleInfo;
import org.dripless.client.managers.module.settings.impl.BooleanSetting;
import org.dripless.client.managers.module.settings.impl.MultiBooleanSetting;
import org.dripless.client.utils.other.Instance;
import org.dripless.client.utils.player.PlayerUtil;
@Getter
@Accessors(fluent = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleInfo(name = "CollisionDisabler", category = Category.MOVEMENT)
public class CollisionDisabler extends Module {
public static CollisionDisabler getInstance() {
return Instance.get(CollisionDisabler.class);
}
private final MultiBooleanSetting collisionSettings = new MultiBooleanSetting(this, "Не замедлятся в",
BooleanSetting.of("Паутине", true),
BooleanSetting.of("Сладких ягодах", true)
);
private boolean inWeb = false;
private boolean inSweetBerries = false;
@EventHandler
public void onUpdate(UpdateEvent event) {
if (mc.player == null || mc.world == null) return;
BlockPos playerPos = new BlockPos(mc.player.getPosX(), mc.player.getPosY(), mc.player.getPosZ());
inWeb = mc.world.getBlockState(playerPos).getBlock() == Blocks.COBWEB ||
mc.world.getBlockState(playerPos.up()).getBlock() == Blocks.COBWEB;
inSweetBerries = mc.world.getBlockState(playerPos).getBlock() == Blocks.SWEET_BERRY_BUSH ||
mc.world.getBlockState(playerPos.up()).getBlock() == Blocks.SWEET_BERRY_BUSH;
if (inWeb && collisionSettings.getValue("Паутине")) {
preventWebSlowdown();
}
if (inSweetBerries && collisionSettings.getValue("Сладких ягодах")) {
preventSweetBerrySlowdown();
}
}
@EventHandler
public void onMove(MoveEvent event) {
if (mc.player == null) return;
if (inWeb && collisionSettings.getValue("Паутине")) {
preventWebSlowdownMovement(event);
}
if (inSweetBerries && collisionSettings.getValue("Сладких ягодах")) {
preventSweetBerrySlowdownMovement(event);
}
}
private void preventWebSlowdown() {
if (mc.player == null) return;
if (PlayerUtil.isPlayerInWeb()) {
}
}
private void preventWebSlowdownMovement(MoveEvent event) {
if (PlayerUtil.isPlayerInWeb()) {
}
}
private void preventSweetBerrySlowdown() {
if (mc.player == null) return;
Vector3d zeroVector = new Vector3d(0.0D, 0.0D, 0.0D);
mc.player.setMotionMultiplier(Blocks.SWEET_BERRY_BUSH.getDefaultState(), zeroVector);
}
private void preventSweetBerrySlowdownMovement(MoveEvent event) {
}
@Override
public void onDisable() {
super.onDisable();
inWeb = false;
inSweetBerries = false;
}
}