Merge remote-tracking branch 'origin/master'

This commit is contained in:
Bella 2020-04-19 12:34:44 -04:00
commit 529ded4143
No known key found for this signature in database
GPG Key ID: DBD4A6030080C8B3
7 changed files with 200 additions and 13 deletions

View File

@ -56,6 +56,10 @@ repositories {
name = "jitpack.io"
url = "https://jitpack.io"
}
maven {
name = 'impact'
url = 'https://impactdevelopment.github.io/maven/'
}
mavenCentral()
jcenter()
}
@ -77,6 +81,7 @@ dependencies {
compile 'club.minnced:java-discord-rpc:2.0.2'
compile 'com.github.MrPowerGamerBR:TemmieWebhook:-SNAPSHOT'
compile 'com.github.kevinsawicki:http-request:http-request-6.0'
compile 'com.github.cabaletta:baritone:v1.2.13'
}
processResources {
@ -112,6 +117,7 @@ shadowJar {
include(dependency('org.javassist:javassist'))
include(dependency('com.github.MrPowerGamerBR:TemmieWebhook'))
include(dependency('com.github.kevinsawicki:http-request'))
include(dependency(group: 'cabaletta', name: 'baritone-api', version: '1.2.13'))
}
exclude 'dummyThing' // can someone explain why this is here
classifier = 'release'
@ -132,7 +138,7 @@ reobf {
jar {
manifest {
attributes(
'MixinConfigs': 'mixins.kami.json',
'MixinConfigs': 'mixins.kami.json', 'mixins.baritone.json',
'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0,
'FMLCorePluginContainsFMLMod': 'true',

View File

@ -0,0 +1,21 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.command.Command;
import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
/**
* Created by Dewy on the 17th of April, 2020
*/
public class BaritoneCommand extends Command {
public BaritoneCommand() {
super("baritone", null);
setDescription("Configure baritone using it's own command system. Try typing '#help'.");
}
@Override
public void call(String[] args) {
sendChatMessage("KAMI Blue has Baritone integration. To configure Baritone, use Baritone's own command system. Try #help for a command list.");
}
}

View File

@ -19,6 +19,7 @@ public class MixinLoaderForge implements IFMLLoadingPlugin {
log.info("KAMI mixins initialized");
MixinBootstrap.init();
Mixins.addConfiguration("mixins.kami.json");
Mixins.addConfiguration("mixins.baritone.json");
MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge");
log.info(MixinEnvironment.getDefaultEnvironment().getObfuscationContext());
}

View File

@ -0,0 +1,52 @@
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.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.util.MessageSendHelper;
import net.minecraft.network.play.server.SPacketChat;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
@Module.Info(
name = "LoginMessage",
description = "Sends a given message to public chat on login.",
category = Module.Category.CHAT
)
public class LoginMessage extends Module {
private String loginMessage;
private boolean sent = false;
@Override
protected void onEnable() {
BufferedReader reader;
try {
MessageSendHelper.sendChatMessage(getChatName() + "Finding login message from loginmsg.txt...");
reader = new BufferedReader(new FileReader("loginmsg.txt"));
loginMessage = reader.readLine();
reader.close();
} catch (FileNotFoundException e) {
MessageSendHelper.sendErrorMessage(getChatName() + "The file '&7loginmsg.txt&f' was not found in your .minecraft folder. Create it and add a message to enable this module.");
disable();
} catch (IOException e) {
KamiMod.log.error(e);
}
}
@EventHandler
public Listener<PacketEvent.Receive> serverConnectedEventListener = new Listener<>(event -> {
if (event.getPacket() instanceof SPacketChat && !sent) {
mc.player.sendChatMessage(loginMessage);
sent = true;
}
});
}

View File

@ -15,6 +15,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.MathHelper;
import static me.zeroeightsix.kami.util.MathsUtils.normalizeAngle;
/**
* Created by Dewy on the 16th of April, 2020
*/
@ -108,16 +110,4 @@ public class AimBot extends Module {
mc.player.setPositionAndRotation(mc.player.posX, mc.player.posY, mc.player.posZ, yaw, -pitch);
}
private double normalizeAngle(double angleIn) {
while (angleIn <= -180.0) {
angleIn += 360.0;
}
while (angleIn > 180.0) {
angleIn -= 360.0;
}
return angleIn;
}
}

View File

@ -0,0 +1,98 @@
package me.zeroeightsix.kami.module.modules.movement;
import baritone.api.BaritoneAPI;
import baritone.api.pathing.goals.GoalXZ;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.events.ServerDisconnectedEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import static me.zeroeightsix.kami.util.MathsUtils.normalizeAngle;
/**
* Created by Dewy on the 17th of April, 2020
*/
@Module.Info(name = "BaritoneWalk", description = "AutoWalk with Baritone pathfinding.", category = Module.Category.MOVEMENT)
public class BaritoneWalk extends Module {
private Setting<Boolean> sprint = register(Settings.booleanBuilder("Allow Sprinting").withValue(true));
private Setting<Boolean> parkour = register(Settings.booleanBuilder("Allow Parkour").withValue(true).withVisibility(v -> sprint.getValue().equals(true)));
private Setting<Boolean> lockView = register(Settings.booleanBuilder("Lock View").withValue(false));
private String direction;
// Very shittily done, but this check is not that taxing on performance cos it is NOT performed every tick.
@Override
protected void onEnable() {
if (normalizeAngle(mc.player.rotationYaw) >= -22.5 && normalizeAngle(mc.player.rotationYaw) <= 22.5) { // +Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX, (int) mc.player.posZ + 1068));
direction = "+Z";
} else if (normalizeAngle(mc.player.rotationYaw) >= 22.6 && normalizeAngle(mc.player.rotationYaw) <= 67.5) { // -X / +Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX - 1068, (int) mc.player.posZ + 1068));
direction = "-X / +Z";
} else if (normalizeAngle(mc.player.rotationYaw) >= 67.6 && normalizeAngle(mc.player.rotationYaw) <= 112.5) { // -X
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX - 1068, (int) mc.player.posZ));
direction = "-X";
} else if (normalizeAngle(mc.player.rotationYaw) >= 112.6 && normalizeAngle(mc.player.rotationYaw) <= 157.5) { // -X / -Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX - 1068, (int) mc.player.posZ - 1068));
direction = "-X / -Z";
} else if (normalizeAngle(mc.player.rotationYaw) >= 157.6 || normalizeAngle(mc.player.rotationYaw) <= -157.5) { // -Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX, (int) mc.player.posZ - 1068));
direction = "-Z";
} else if (normalizeAngle(mc.player.rotationYaw) >= -157.6 && normalizeAngle(mc.player.rotationYaw) <= -112.5) { // +X / -Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX + 1068, (int) mc.player.posZ - 1068));
direction = "+X / -Z";
} else if (normalizeAngle(mc.player.rotationYaw) >= -112.6 && normalizeAngle(mc.player.rotationYaw) <= -67.5) { // +X
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX + 1068, (int) mc.player.posZ));
direction = "+X";
} else if (normalizeAngle(mc.player.rotationYaw) >= -67.6 && normalizeAngle(mc.player.rotationYaw) <= -22.6) { // +X / +Z
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX + 1068, (int) mc.player.posZ + 1068));
direction = "+X / +Z";
}
}
@Override
public void onUpdate() {
BaritoneAPI.getSettings().allowSprint.value = sprint.getValue();
BaritoneAPI.getSettings().freeLook.value = !lockView.getValue();
if (sprint.getValue()) {
BaritoneAPI.getSettings().allowParkour.value = parkour.getValue();
}
}
@Override
public String getHudInfo() {
return direction;
}
@Override
protected void onDisable() {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(null);
BaritoneAPI.getSettings().freeLook.reset();
BaritoneAPI.getSettings().allowParkour.reset();
BaritoneAPI.getSettings().allowSprint.reset();
}
@EventHandler
private Listener<ServerDisconnectedEvent> disconnectedEventListener = new Listener<>(event -> {
System.out.println("bBBBB");
if (KamiMod.MODULE_MANAGER.getModuleT(BaritoneWalk.class).isEnabled()) {
KamiMod.MODULE_MANAGER.getModuleT(BaritoneWalk.class).destroy();
}
});
}

View File

@ -0,0 +1,19 @@
package me.zeroeightsix.kami.util;
/**
* Created by Dewy on the 17th of April, 2020
*/
public class MathsUtils {
public static double normalizeAngle(double angleIn) {
while (angleIn <= -180.0) {
angleIn += 360.0;
}
while (angleIn > 180.0) {
angleIn -= 360.0;
}
return angleIn;
}
}