added bedaura

This commit is contained in:
Bella 2020-03-24 15:17:42 -04:00
parent 8e192ba414
commit b560408564
No known key found for this signature in database
GPG Key ID: 815562EA23BFE344
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
package me.zeroeightsix.kami.module.modules.combat;
import java.util.Comparator;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.tileentity.TileEntityBed;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.Vec3d;
@Module.Info(name = "BedAura", category = Module.Category.COMBAT, description = "Automatically right clicks beds in range")
public class BedAura extends Module {
private Setting<Integer> waitTick = register(Settings.i("Tick Delay", 10));
private Setting<Double> range = register(Settings.d("Hit Range", 4.0D));
private int waitCounter;
public void onUpdate() {
if (mc.player == null) return;
if (mc.player.dimension != 0) {
if (waitTick.getValue() > 0) {
if (waitCounter < waitTick.getValue()) {
++waitCounter;
return;
}
waitCounter = 0;
}
mc.world.loadedTileEntityList.stream()
.filter((e) -> e instanceof TileEntityBed)
.filter((e) -> mc.player.getPosition().getDistance(e.getPos().x, e.getPos().y, e.getPos().z) <= range.getValue())
.map((entity) -> (TileEntityBed) entity)
.min(Comparator.comparing((e) -> mc.player.getPosition().getDistance(e.getPos().x, e.getPos().y, e.getPos().z)))
.ifPresent(bed -> mc.playerController.processRightClickBlock(mc.player, mc.world, bed.getPos(), EnumFacing.UP, new Vec3d(bed.getPos().getX(), bed.getPos().getY(), bed.getPos().getZ()), EnumHand.MAIN_HAND));
} else {
Command.sendErrorMessage(getChatName() + "Exploding beds only works in the nether and in the end, disabling!");
disable();
}
}
}