mirror of
https://github.com/kami-blue/client
synced 2025-02-20 23:27:14 +00:00
use mathutils
This commit is contained in:
parent
529ded4143
commit
4eeae5d339
@ -3,7 +3,6 @@ package me.zeroeightsix.kami.module.modules.chat;
|
||||
import me.zero.alpine.listener.EventHandler;
|
||||
import me.zero.alpine.listener.Listener;
|
||||
import me.zeroeightsix.kami.KamiMod;
|
||||
import me.zeroeightsix.kami.event.events.ChatReceivedEvent;
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
@ -18,7 +17,6 @@ import java.util.stream.Collectors;
|
||||
import static me.zeroeightsix.kami.util.MessageDetectionHelper.isDirect;
|
||||
import static me.zeroeightsix.kami.util.MessageDetectionHelper.isDirectOther;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendRawChatMessage;
|
||||
|
||||
/**
|
||||
* @author hub
|
||||
|
@ -10,7 +10,7 @@ import net.minecraft.network.play.client.CPacketChatMessage;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.isNumberEven;
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.isNumberEven;
|
||||
|
||||
/**
|
||||
* @author dominikaaaa
|
||||
|
@ -12,8 +12,8 @@ import static me.zeroeightsix.kami.KamiMod.MODULE_MANAGER;
|
||||
import static me.zeroeightsix.kami.util.ColourConverter.rgbToInt;
|
||||
import static me.zeroeightsix.kami.util.ColourTextFormatting.colourEnumMap;
|
||||
import static me.zeroeightsix.kami.util.ColourTextFormatting.toTextMap;
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.isNumberEven;
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.reverseNumber;
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.isNumberEven;
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.reverseNumber;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendDisableMessage;
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static me.zeroeightsix.kami.util.ColourTextFormatting.toTextMap;
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.speed;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendDisableMessage;
|
||||
|
||||
/**
|
||||
@ -79,7 +80,7 @@ public class InfoOverlay extends Module {
|
||||
} if (fps.getValue()) {
|
||||
infoContents.add(getStringColour(setToText(firstColour.getValue())) + Minecraft.debugFPS + getStringColour(setToText(secondColour.getValue())) + " fps");
|
||||
} if (speed.getValue()) {
|
||||
infoContents.add(getStringColour(setToText(firstColour.getValue())) + InfoCalculator.speed(useUnitKmH(), mc) + getStringColour(setToText(secondColour.getValue())) + " " + unitType(speedUnit.getValue()));
|
||||
infoContents.add(getStringColour(setToText(firstColour.getValue())) + speed(useUnitKmH(), mc) + getStringColour(setToText(secondColour.getValue())) + " " + unitType(speedUnit.getValue()));
|
||||
} if (timerSpeed.getValue()) {
|
||||
infoContents.add(getStringColour(setToText(firstColour.getValue())) + TimerSpeed.returnGui() + getStringColour(setToText(secondColour.getValue())) + "t");
|
||||
} if (ping.getValue()) {
|
||||
|
@ -8,7 +8,7 @@ import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.reverseNumber;
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.reverseNumber;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendWarningMessage;
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,8 @@ import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.module.Module.Category;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import me.zeroeightsix.kami.util.InfoCalculator;
|
||||
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.round;
|
||||
|
||||
/**
|
||||
* @author TBM
|
||||
@ -24,7 +25,7 @@ public class TimerSpeed extends Module {
|
||||
private Setting<Float> fastSpeed = register(Settings.floatBuilder("Fast Speed").withMinimum(1.0F).withMaximum(10.0F).withValue(5.0F).build());
|
||||
|
||||
public static String returnGui() {
|
||||
return "" + InfoCalculator.round(curSpeed, 2);
|
||||
return "" + round(curSpeed, 2);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
|
@ -10,7 +10,7 @@ import me.zeroeightsix.kami.setting.Settings;
|
||||
import me.zeroeightsix.kami.util.Wrapper;
|
||||
|
||||
import static me.zeroeightsix.kami.gui.kami.DisplayGuiScreen.getScale;
|
||||
import static me.zeroeightsix.kami.util.InfoCalculator.round;
|
||||
import static me.zeroeightsix.kami.util.MathsUtils.round;
|
||||
|
||||
/**
|
||||
* @author dominikaaaa
|
||||
|
@ -80,21 +80,6 @@ public class InfoCalculator {
|
||||
}
|
||||
// }
|
||||
|
||||
// Round {
|
||||
public static double round(double value, int places) {
|
||||
double scale = Math.pow(10, places);
|
||||
return Math.round(value * scale) / scale;
|
||||
}
|
||||
// }
|
||||
|
||||
// Is Even {
|
||||
public static boolean isNumberEven(int i) { return (i & 1) == 0; }
|
||||
// }
|
||||
|
||||
// Reverse Number {
|
||||
public static int reverseNumber(int num, int min, int max) { return (max + min) - num; }
|
||||
// }
|
||||
|
||||
// Cardinal to Axis {
|
||||
public static String cardinalToAxis(char cardinal) {
|
||||
switch (cardinal) {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package me.zeroeightsix.kami.util;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Created by Dewy on the 17th of April, 2020
|
||||
*/
|
||||
@ -16,4 +21,13 @@ public class MathsUtils {
|
||||
|
||||
return angleIn;
|
||||
}
|
||||
|
||||
public static double round(double value, int places) {
|
||||
double scale = Math.pow(10, places);
|
||||
return Math.round(value * scale) / scale;
|
||||
}
|
||||
|
||||
public static boolean isNumberEven(int i) { return (i & 1) == 0; }
|
||||
|
||||
public static int reverseNumber(int num, int min, int max) { return (max + min) - num; }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user