This commit is contained in:
parent
07a076e8ad
commit
bcc322cb26
|
|
@ -0,0 +1,14 @@
|
||||||
|
package keystrokesmod.event;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
|
public class AntiCheatFlagEvent extends Event {
|
||||||
|
public String flag;
|
||||||
|
public Entity entity;
|
||||||
|
|
||||||
|
public AntiCheatFlagEvent(String flag, Entity entity) {
|
||||||
|
this.flag = flag;
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package keystrokesmod.mixin.impl.accessor;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Mixin(GuiScreen.class)
|
||||||
|
public interface IAccessorGuiScreen {
|
||||||
|
@Invoker("mouseClicked")
|
||||||
|
void callMouseClicked(int mouseX, int mouseY, int mouseButton);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package keystrokesmod.mixin.impl.accessor;
|
||||||
|
|
||||||
|
import net.minecraft.network.play.server.S14PacketEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(S14PacketEntity.class)
|
||||||
|
public interface IAccessorS14PacketEntity {
|
||||||
|
@Accessor("entityId")
|
||||||
|
int getEntityId();
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,6 @@ import keystrokesmod.module.impl.other.*;
|
||||||
import keystrokesmod.module.impl.player.*;
|
import keystrokesmod.module.impl.player.*;
|
||||||
import keystrokesmod.module.impl.render.*;
|
import keystrokesmod.module.impl.render.*;
|
||||||
import keystrokesmod.module.impl.world.*;
|
import keystrokesmod.module.impl.world.*;
|
||||||
import keystrokesmod.utility.ModuleUtils;
|
|
||||||
import keystrokesmod.utility.Utils;
|
import keystrokesmod.utility.Utils;
|
||||||
import keystrokesmod.utility.profile.Manager;
|
import keystrokesmod.utility.profile.Manager;
|
||||||
|
|
||||||
|
|
@ -71,6 +70,7 @@ public class ModuleManager {
|
||||||
public static Arrows arrows;
|
public static Arrows arrows;
|
||||||
public static ChatCommands chatCommands;
|
public static ChatCommands chatCommands;
|
||||||
public static LongJump LongJump;
|
public static LongJump LongJump;
|
||||||
|
public static CTWFly ctwFly;
|
||||||
public static Blink blink;
|
public static Blink blink;
|
||||||
public static Velocity velocity;
|
public static Velocity velocity;
|
||||||
|
|
||||||
|
|
@ -170,6 +170,7 @@ public class ModuleManager {
|
||||||
this.addModule(new AutoWho());
|
this.addModule(new AutoWho());
|
||||||
this.addModule(new Gui());
|
this.addModule(new Gui());
|
||||||
this.addModule(new Shaders());
|
this.addModule(new Shaders());
|
||||||
|
this.addModule(ctwFly = new CTWFly());
|
||||||
antiBot.enable();
|
antiBot.enable();
|
||||||
Collections.sort(this.modules, Comparator.comparing(Module::getName));
|
Collections.sort(this.modules, Comparator.comparing(Module::getName));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package keystrokesmod.module.impl.combat;
|
package keystrokesmod.module.impl.combat;
|
||||||
|
|
||||||
|
import keystrokesmod.mixin.impl.accessor.IAccessorGuiScreen;
|
||||||
import keystrokesmod.module.Module;
|
import keystrokesmod.module.Module;
|
||||||
import keystrokesmod.module.ModuleManager;
|
import keystrokesmod.module.ModuleManager;
|
||||||
import keystrokesmod.module.setting.impl.ButtonSetting;
|
import keystrokesmod.module.setting.impl.ButtonSetting;
|
||||||
|
|
@ -9,12 +10,11 @@ import keystrokesmod.utility.Reflection;
|
||||||
import keystrokesmod.utility.Utils;
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||||
|
|
@ -22,8 +22,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class AutoClicker extends Module {
|
public class AutoClicker extends Module {
|
||||||
|
|
@ -38,19 +36,20 @@ public class AutoClicker extends Module {
|
||||||
public ButtonSetting weaponOnly;
|
public ButtonSetting weaponOnly;
|
||||||
public ButtonSetting blocksOnly;
|
public ButtonSetting blocksOnly;
|
||||||
public ButtonSetting disableCreative;
|
public ButtonSetting disableCreative;
|
||||||
|
|
||||||
|
private long nextReleaseTime;
|
||||||
|
private long nextPressTime;
|
||||||
|
private long nextMultiplierUpdateTime;
|
||||||
|
private long nextExtraDelayUpdateTime;
|
||||||
|
private double delayMultiplier;
|
||||||
|
private boolean multiplierActive;
|
||||||
|
private boolean isHoldingBlockBreak;
|
||||||
|
private boolean isBlockHitActive;
|
||||||
|
|
||||||
private Random rand = null;
|
private Random rand = null;
|
||||||
private Method gs;
|
|
||||||
private long i;
|
|
||||||
private long j;
|
|
||||||
private long k;
|
|
||||||
private long l;
|
|
||||||
private double m;
|
|
||||||
private boolean n;
|
|
||||||
private boolean hol;
|
|
||||||
private boolean blocked;
|
|
||||||
|
|
||||||
public AutoClicker() {
|
public AutoClicker() {
|
||||||
super("AutoClicker", Module.category.combat, 0);
|
super("AutoClicker", category.combat, 0);
|
||||||
this.registerSetting(new DescriptionSetting("Best with delay remover."));
|
this.registerSetting(new DescriptionSetting("Best with delay remover."));
|
||||||
this.registerSetting(minCPS = new SliderSetting("Min CPS", 9.0, 1.0, 20.0, 0.5));
|
this.registerSetting(minCPS = new SliderSetting("Min CPS", 9.0, 1.0, 20.0, 0.5));
|
||||||
this.registerSetting(maxCPS = new SliderSetting("Max CPS", 12.0, 1.0, 20.0, 0.5));
|
this.registerSetting(maxCPS = new SliderSetting("Max CPS", 12.0, 1.0, 20.0, 0.5));
|
||||||
|
|
@ -64,35 +63,20 @@ public class AutoClicker extends Module {
|
||||||
this.registerSetting(blocksOnly = new ButtonSetting("Blocks only", true));
|
this.registerSetting(blocksOnly = new ButtonSetting("Blocks only", true));
|
||||||
this.registerSetting(disableCreative = new ButtonSetting("Disable in creative", false));
|
this.registerSetting(disableCreative = new ButtonSetting("Disable in creative", false));
|
||||||
this.closetModule = true;
|
this.closetModule = true;
|
||||||
|
|
||||||
try {
|
|
||||||
this.gs = GuiScreen.class.getDeclaredMethod("func_73864_a", Integer.TYPE, Integer.TYPE, Integer.TYPE);
|
|
||||||
} catch (Exception var4) {
|
|
||||||
try {
|
|
||||||
this.gs = GuiScreen.class.getDeclaredMethod("mouseClicked", Integer.TYPE, Integer.TYPE, Integer.TYPE);
|
|
||||||
} catch (Exception var3) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.gs != null) {
|
|
||||||
this.gs.setAccessible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
if (this.gs == null) {
|
this.isBlockHitActive = Mouse.isButtonDown(1);
|
||||||
this.disable();
|
|
||||||
}
|
|
||||||
this.blocked = Mouse.isButtonDown(1);
|
|
||||||
this.rand = new Random();
|
this.rand = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
this.i = 0L;
|
this.nextReleaseTime = 0L;
|
||||||
this.j = 0L;
|
this.nextPressTime = 0L;
|
||||||
this.hol = false;
|
this.isHoldingBlockBreak = false;
|
||||||
this.blocked = false;
|
this.isBlockHitActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void guiUpdate() {
|
public void guiUpdate() {
|
||||||
|
|
@ -101,160 +85,153 @@ public class AutoClicker extends Module {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderTick(RenderTickEvent ev) {
|
public void onRenderTick(RenderTickEvent ev) {
|
||||||
if (ev.phase != Phase.END && Utils.nullCheck() && !mc.thePlayer.isEating()) {
|
if (ev.phase != Phase.END && Utils.nullCheck() && !Utils.isConsuming(mc.thePlayer)) {
|
||||||
if (disableCreative.isToggled() && mc.thePlayer.capabilities.isCreativeMode) {
|
if (disableCreative.isToggled() && mc.thePlayer.capabilities.isCreativeMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ModuleManager.scaffold.isEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mc.currentScreen == null && mc.inGameHasFocus) {
|
if (mc.currentScreen == null && mc.inGameHasFocus) {
|
||||||
if (weaponOnly.isToggled() && !Utils.holdingWeapon()) {
|
if (weaponOnly.isToggled() && !Utils.holdingWeapon()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftClick.isToggled() && Mouse.isButtonDown(0)) {
|
if (leftClick.isToggled() && Mouse.isButtonDown(0)) {
|
||||||
this.dc(mc.gameSettings.keyBindAttack.getKeyCode(), 0);
|
this.performClick(mc.gameSettings.keyBindAttack.getKeyCode(), 0);
|
||||||
}
|
}
|
||||||
else if (rightClick.isToggled() && Mouse.isButtonDown(1)) {
|
else if (rightClick.isToggled() && Mouse.isButtonDown(1)) {
|
||||||
if (blocksOnly.isToggled() && (mc.thePlayer.getCurrentEquippedItem() == null || !(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock))) {
|
if (blocksOnly.isToggled() && (mc.thePlayer.getCurrentEquippedItem() == null || !(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dc(mc.gameSettings.keyBindUseItem.getKeyCode(), 1);
|
if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemBow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.performClick(mc.gameSettings.keyBindUseItem.getKeyCode(), 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.i = 0L;
|
this.nextReleaseTime = 0L;
|
||||||
this.j = 0L;
|
this.nextPressTime = 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (inventoryFill.isToggled() && mc.currentScreen instanceof GuiInventory) {
|
else if (inventoryFill.isToggled() && mc.currentScreen instanceof GuiInventory) {
|
||||||
if (!Mouse.isButtonDown(0) || !Keyboard.isKeyDown(54) && !Keyboard.isKeyDown(42)) {
|
if (!Mouse.isButtonDown(0) || (!Keyboard.isKeyDown(54) && !Keyboard.isKeyDown(42))) {
|
||||||
this.i = 0L;
|
this.nextReleaseTime = 0L;
|
||||||
this.j = 0L;
|
this.nextPressTime = 0L;
|
||||||
} else if (this.i != 0L && this.j != 0L) {
|
}
|
||||||
if (System.currentTimeMillis() > this.j) {
|
else if (this.nextReleaseTime != 0L && this.nextPressTime != 0L) {
|
||||||
this.gd();
|
if (System.currentTimeMillis() > this.nextPressTime) {
|
||||||
|
this.updateClickDelay();
|
||||||
this.inventoryClick(mc.currentScreen);
|
this.inventoryClick(mc.currentScreen);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
this.gd();
|
else {
|
||||||
|
this.updateClickDelay();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void performClick(int key, int mouse) {
|
||||||
}
|
|
||||||
|
|
||||||
public void dc(int key, int mouse) {
|
|
||||||
if (breakBlocks.isToggled() && mouse == 0 && mc.objectMouseOver != null) {
|
if (breakBlocks.isToggled() && mouse == 0 && mc.objectMouseOver != null) {
|
||||||
BlockPos p = mc.objectMouseOver.getBlockPos();
|
BlockPos pos = mc.objectMouseOver.getBlockPos();
|
||||||
if (p != null) {
|
if (pos != null) {
|
||||||
Block bl = mc.theWorld.getBlockState(p).getBlock();
|
Block block = mc.theWorld.getBlockState(pos).getBlock();
|
||||||
if (bl != Blocks.air && !(bl instanceof BlockLiquid)) {
|
if (block != Blocks.air && !(block instanceof BlockLiquid)) {
|
||||||
if (!this.hol && (!ModuleManager.killAura.isEnabled() || KillAura.target == null)) {
|
if (!this.isHoldingBlockBreak && (!ModuleManager.killAura.isEnabled() || KillAura.target == null)) {
|
||||||
KeyBinding.setKeyBindState(key, true);
|
KeyBinding.setKeyBindState(key, true);
|
||||||
KeyBinding.onTick(key);
|
KeyBinding.onTick(key);
|
||||||
this.hol = true;
|
this.isHoldingBlockBreak = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.isHoldingBlockBreak) {
|
||||||
if (this.hol) {
|
|
||||||
KeyBinding.setKeyBindState(key, false);
|
KeyBinding.setKeyBindState(key, false);
|
||||||
this.hol = false;
|
this.isHoldingBlockBreak = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jitter.getInput() > 0.0D) {
|
if (jitter.getInput() > 0.0D) {
|
||||||
double a = jitter.getInput() * 0.45D;
|
double jitterAmount = jitter.getInput() * 0.45D;
|
||||||
EntityPlayerSP var10000;
|
|
||||||
if (this.rand.nextBoolean()) {
|
if (this.rand.nextBoolean()) {
|
||||||
var10000 = mc.thePlayer;
|
mc.thePlayer.rotationYaw += this.rand.nextFloat() * jitterAmount;
|
||||||
var10000.rotationYaw = (float) ((double) var10000.rotationYaw + (double) this.rand.nextFloat() * a);
|
}
|
||||||
} else {
|
else {
|
||||||
var10000 = mc.thePlayer;
|
mc.thePlayer.rotationYaw -= this.rand.nextFloat() * jitterAmount;
|
||||||
var10000.rotationYaw = (float) ((double) var10000.rotationYaw - (double) this.rand.nextFloat() * a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.rand.nextBoolean()) {
|
if (this.rand.nextBoolean()) {
|
||||||
var10000 = mc.thePlayer;
|
mc.thePlayer.rotationPitch += this.rand.nextFloat() * jitterAmount * 0.45D;
|
||||||
var10000.rotationPitch = (float) ((double) var10000.rotationPitch + (double) this.rand.nextFloat() * a * 0.45D);
|
}
|
||||||
} else {
|
else {
|
||||||
var10000 = mc.thePlayer;
|
mc.thePlayer.rotationPitch -= this.rand.nextFloat() * jitterAmount * 0.45D;
|
||||||
var10000.rotationPitch = (float) ((double) var10000.rotationPitch - (double) this.rand.nextFloat() * a * 0.45D);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.j > 0L && this.i > 0L) {
|
if (this.nextPressTime > 0L && this.nextReleaseTime > 0L) {
|
||||||
double blockHitC = blockHitChance.getInput();
|
double blockHitC = blockHitChance.getInput();
|
||||||
if (System.currentTimeMillis() > this.j && (!ModuleManager.killAura.isEnabled() || KillAura.target == null)) {
|
long currentTime = System.currentTimeMillis();
|
||||||
|
if (currentTime > this.nextPressTime && (!ModuleManager.killAura.isEnabled() || KillAura.target == null)) {
|
||||||
KeyBinding.setKeyBindState(key, true);
|
KeyBinding.setKeyBindState(key, true);
|
||||||
KeyBinding.onTick(key);
|
KeyBinding.onTick(key);
|
||||||
Reflection.setButton(mouse, true);
|
Reflection.setButton(mouse, true);
|
||||||
if (mouse == 0 && blockHitC > 0.0 && Mouse.isButtonDown(1) && Math.random() >= (100.0 - blockHitC) / 100.0) {
|
if (mouse == 0 && blockHitC > 0.0 && Mouse.isButtonDown(1) && Math.random() >= (100.0 - blockHitC) / 100.0) {
|
||||||
final int getKeyCode = mc.gameSettings.keyBindUseItem.getKeyCode();
|
final int useItemKey = mc.gameSettings.keyBindUseItem.getKeyCode();
|
||||||
KeyBinding.setKeyBindState(getKeyCode, true);
|
KeyBinding.setKeyBindState(useItemKey, true);
|
||||||
KeyBinding.onTick(getKeyCode);
|
KeyBinding.onTick(useItemKey);
|
||||||
Reflection.setButton(1, true);
|
Reflection.setButton(1, true);
|
||||||
blocked = true;
|
isBlockHitActive = true;
|
||||||
}
|
}
|
||||||
this.gd();
|
// Recalculate the next press and release times.
|
||||||
|
this.updateClickDelay();
|
||||||
}
|
}
|
||||||
else if (System.currentTimeMillis() > this.i || blocked) {
|
// If the release time has passed (or a block hit is active), release the key.
|
||||||
|
else if (currentTime > this.nextReleaseTime || isBlockHitActive) {
|
||||||
KeyBinding.setKeyBindState(key, false);
|
KeyBinding.setKeyBindState(key, false);
|
||||||
Reflection.setButton(mouse, false);
|
Reflection.setButton(mouse, false);
|
||||||
if (mouse == 0 && blockHitC > 0.0) {
|
if (mouse == 0 && blockHitC > 0.0) {
|
||||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
|
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
|
||||||
Reflection.setButton(1, false);
|
Reflection.setButton(1, false);
|
||||||
blocked = false;
|
isBlockHitActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.gd();
|
this.updateClickDelay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void updateClickDelay() {
|
||||||
|
double cps = Utils.getRandomValue(minCPS, maxCPS, this.rand) + 0.4D * this.rand.nextDouble();
|
||||||
|
long delay = Math.round(1000.0D / cps);
|
||||||
|
|
||||||
public void gd() {
|
long currentTime = System.currentTimeMillis();
|
||||||
double c = Utils.getRandomValue(minCPS, maxCPS, this.rand) + 0.4D * this.rand.nextDouble();
|
// Updates the delay multiplier periodically.
|
||||||
long d = (long) ((int) Math.round(1000.0D / c));
|
if (currentTime > this.nextMultiplierUpdateTime) {
|
||||||
if (System.currentTimeMillis() > this.k) {
|
if (!multiplierActive && this.rand.nextInt(100) >= 85) {
|
||||||
if (!this.n && this.rand.nextInt(100) >= 85) {
|
multiplierActive = true;
|
||||||
this.n = true;
|
delayMultiplier = 1.1D + this.rand.nextDouble() * 0.15D;
|
||||||
this.m = 1.1D + this.rand.nextDouble() * 0.15D;
|
|
||||||
} else {
|
} else {
|
||||||
this.n = false;
|
multiplierActive = false;
|
||||||
}
|
}
|
||||||
|
this.nextMultiplierUpdateTime = currentTime + 500L + this.rand.nextInt(1500);
|
||||||
this.k = System.currentTimeMillis() + 500L + (long) this.rand.nextInt(1500);
|
|
||||||
}
|
}
|
||||||
|
// Adds extra delay at randomized intervals
|
||||||
if (this.n) {
|
if (currentTime > this.nextExtraDelayUpdateTime) {
|
||||||
d = (long) ((double) d * this.m);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() > this.l) {
|
|
||||||
if (this.rand.nextInt(100) >= 80) {
|
if (this.rand.nextInt(100) >= 80) {
|
||||||
d += 50L + (long) this.rand.nextInt(100);
|
delay += 50L + this.rand.nextInt(100);
|
||||||
}
|
}
|
||||||
|
this.nextExtraDelayUpdateTime = currentTime + 500L + this.rand.nextInt(1500);
|
||||||
this.l = System.currentTimeMillis() + 500L + (long) this.rand.nextInt(1500);
|
}
|
||||||
}
|
// If the multiplier is active, adjust the delay
|
||||||
|
if (multiplierActive) {
|
||||||
this.j = System.currentTimeMillis() + d;
|
delay = (long) (delay * delayMultiplier);
|
||||||
this.i = System.currentTimeMillis() + d / 2L - (long) this.rand.nextInt(10);
|
}
|
||||||
}
|
// Schedule the next press and release events
|
||||||
|
this.nextPressTime = currentTime + delay;
|
||||||
private void inventoryClick(GuiScreen s) {
|
this.nextReleaseTime = currentTime + delay / 2L - this.rand.nextInt(10);
|
||||||
int x = Mouse.getX() * s.width / mc.displayWidth;
|
|
||||||
int y = s.height - Mouse.getY() * s.height / mc.displayHeight - 1;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.gs.invoke(s, x, y, 0);
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException var5) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void inventoryClick(GuiScreen screen) {
|
||||||
|
int x = Mouse.getX() * screen.width / mc.displayWidth;
|
||||||
|
int y = screen.height - Mouse.getY() * screen.height / mc.displayHeight - 1;
|
||||||
|
((IAccessorGuiScreen) screen).callMouseClicked(x, y, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,8 +228,8 @@ public class KillAura extends Module {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (target != null && Utils.holdingSword()) {
|
if (target != null && Utils.holdingSword()) {
|
||||||
if (Mouse.isButtonDown(0)) {
|
if (Mouse.isButtonDown(0) && Utils.tabbedIn()) {
|
||||||
swingItem();
|
mc.thePlayer.swingItem();
|
||||||
}
|
}
|
||||||
if (blinkAutoBlock() || autoBlockMode.getInput() == 2) {
|
if (blinkAutoBlock() || autoBlockMode.getInput() == 2) {
|
||||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
|
KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false);
|
||||||
|
|
@ -1011,7 +1011,7 @@ public class KillAura extends Module {
|
||||||
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
|
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
|
||||||
}
|
}
|
||||||
firstEdge++;
|
firstEdge++;
|
||||||
if (firstEdge > 3) {
|
if (firstEdge > 1) {
|
||||||
firstEdge = 0;
|
firstEdge = 0;
|
||||||
}
|
}
|
||||||
lag = false;
|
lag = false;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,34 @@
|
||||||
package keystrokesmod.module.impl.minigames;
|
package keystrokesmod.module.impl.minigames;
|
||||||
|
|
||||||
|
import keystrokesmod.event.ReceivePacketEvent;
|
||||||
|
import keystrokesmod.event.SendPacketEvent;
|
||||||
import keystrokesmod.module.Module;
|
import keystrokesmod.module.Module;
|
||||||
import keystrokesmod.module.impl.world.AntiBot;
|
import keystrokesmod.module.impl.world.AntiBot;
|
||||||
import keystrokesmod.module.setting.impl.ButtonSetting;
|
import keystrokesmod.module.setting.impl.ButtonSetting;
|
||||||
import keystrokesmod.module.setting.impl.DescriptionSetting;
|
import keystrokesmod.module.setting.impl.DescriptionSetting;
|
||||||
|
import keystrokesmod.utility.BlockUtils;
|
||||||
import keystrokesmod.utility.RenderUtils;
|
import keystrokesmod.utility.RenderUtils;
|
||||||
import keystrokesmod.utility.Utils;
|
import keystrokesmod.utility.Utils;
|
||||||
|
import net.minecraft.block.BlockBed;
|
||||||
import net.minecraft.block.BlockObsidian;
|
import net.minecraft.block.BlockObsidian;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.monster.EntityIronGolem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemEnderPearl;
|
import net.minecraft.item.ItemEnderPearl;
|
||||||
import net.minecraft.item.ItemFireball;
|
import net.minecraft.item.ItemFireball;
|
||||||
|
import net.minecraft.item.ItemMonsterPlacer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
|
||||||
|
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
@ -30,13 +43,19 @@ public class BedWars extends Module {
|
||||||
private ButtonSetting enderPearl;
|
private ButtonSetting enderPearl;
|
||||||
private ButtonSetting obsidian;
|
private ButtonSetting obsidian;
|
||||||
private ButtonSetting shouldPing;
|
private ButtonSetting shouldPing;
|
||||||
|
|
||||||
private BlockPos spawnPos;
|
private BlockPos spawnPos;
|
||||||
private boolean check;
|
private boolean check;
|
||||||
|
|
||||||
public static boolean outsideSpawn = true;
|
public static boolean outsideSpawn = true;
|
||||||
|
|
||||||
private List<String> armoredPlayer = new ArrayList<>();
|
private List<String> armoredPlayer = new ArrayList<>();
|
||||||
private Map<String, String> lastHeldMap = new ConcurrentHashMap<>();
|
private Map<String, String> lastHeldMap = new ConcurrentHashMap<>();
|
||||||
private Set<BlockPos> obsidianPos = new HashSet<>();
|
private Map<BlockPos, Long> obsidianPos = new HashMap<>(); // blockPos, time received
|
||||||
private int obsidianColor = new Color(0, 0,0).getRGB();
|
public List<SkyWars.SpawnEggInfo> entitySpawnQueue = new ArrayList<>();
|
||||||
|
public List<Integer> spawnedMobs = new ArrayList<>(); // entity id
|
||||||
|
|
||||||
|
private int obsidianColor = new Color(106, 13, 173).getRGB();
|
||||||
|
|
||||||
public BedWars() {
|
public BedWars() {
|
||||||
super("Bed Wars", category.minigames);
|
super("Bed Wars", category.minigames);
|
||||||
|
|
@ -57,24 +76,30 @@ public class BedWars extends Module {
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
outsideSpawn = true;
|
outsideSpawn = true;
|
||||||
|
entitySpawnQueue.clear();
|
||||||
|
spawnedMobs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onRenderWorld(RenderWorldLastEvent e) {
|
public void onRenderWorld(RenderWorldLastEvent e) {
|
||||||
if (Utils.nullCheck()) {
|
if (Utils.nullCheck()) {
|
||||||
if (this.obsidianPos.isEmpty()) {
|
if (this.obsidianPos.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Iterator<BlockPos> iterator = this.obsidianPos.iterator();
|
Iterator<Map.Entry<BlockPos, Long>> iterator = this.obsidianPos.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
BlockPos blockPos = iterator.next();
|
Map.Entry<BlockPos, Long> entry = iterator.next();
|
||||||
if (!(mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockObsidian)) {
|
BlockPos blockPos = entry.getKey();
|
||||||
|
Long receivedMs = entry.getValue();
|
||||||
|
|
||||||
|
if (!(mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockObsidian) && Utils.timeBetween(System.currentTimeMillis(), receivedMs) >= 500) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RenderUtils.renderBlock(blockPos, obsidianColor, false, true);
|
RenderUtils.renderBlock(blockPos, obsidianColor, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception exception) {}
|
catch (Exception exception) {}
|
||||||
}
|
}
|
||||||
|
|
@ -82,13 +107,29 @@ public class BedWars extends Module {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityJoinWorld(EntityJoinWorldEvent e) {
|
public void onEntityJoinWorld(EntityJoinWorldEvent e) {
|
||||||
if (!Utils.nullCheck() || e.entity == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.entity == mc.thePlayer) {
|
if (e.entity == mc.thePlayer) {
|
||||||
armoredPlayer.clear();
|
armoredPlayer.clear();
|
||||||
lastHeldMap.clear();
|
lastHeldMap.clear();
|
||||||
obsidianPos.clear();
|
obsidianPos.clear();
|
||||||
|
entitySpawnQueue.clear();
|
||||||
|
spawnedMobs.clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (e.entity != null && e.entity instanceof EntityIronGolem) {
|
||||||
|
if (Utils.getBedwarsStatus() != 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vec3 spawnPosition = new Vec3(e.entity.posX, e.entity.posY, e.entity.posZ);
|
||||||
|
for (SkyWars.SpawnEggInfo eggInfo : entitySpawnQueue) {
|
||||||
|
if (eggInfo.spawnPos.distanceTo(spawnPosition) > 3 || Utils.timeBetween(mc.thePlayer.ticksExisted, eggInfo.tickSpawned) > 60) { // 3 seconds or not at spawn point then not own mob
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!entitySpawnQueue.remove(eggInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
spawnedMobs.add(e.entity.getEntityId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +161,7 @@ public class BedWars extends Module {
|
||||||
if (itemType != null) {
|
if (itemType != null) {
|
||||||
lastHeldMap.put(name, itemType);
|
lastHeldMap.put(name, itemType);
|
||||||
double distance = Math.round(mc.thePlayer.getDistanceToEntity(p));
|
double distance = Math.round(mc.thePlayer.getDistanceToEntity(p));
|
||||||
handleAlert(itemType, p.getDisplayName().getFormattedText(), Utils.isWholeNumber(distance) ? (int) distance + "" : String.valueOf(distance));
|
handleAlert(itemType, p.getDisplayName().getFormattedText(), Utils.asWholeNum(distance));
|
||||||
}
|
}
|
||||||
} else if (lastHeldMap.containsKey(name)) {
|
} else if (lastHeldMap.containsKey(name)) {
|
||||||
String itemType = lastHeldMap.get(name);
|
String itemType = lastHeldMap.get(name);
|
||||||
|
|
@ -148,6 +189,41 @@ public class BedWars extends Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onSendPacket(SendPacketEvent e) {
|
||||||
|
if (e.getPacket() instanceof C08PacketPlayerBlockPlacement) {
|
||||||
|
C08PacketPlayerBlockPlacement p = (C08PacketPlayerBlockPlacement) e.getPacket();
|
||||||
|
if (p.getPlacedBlockDirection() != 255 && p.getStack() != null && p.getStack().getItem() != null) {
|
||||||
|
if (p.getStack().getItem() instanceof ItemMonsterPlacer) {
|
||||||
|
Class<? extends Entity> oclass = EntityList.stringToClassMapping.get(ItemMonsterPlacer.getEntityName(p.getStack()));
|
||||||
|
if (oclass.getSimpleName().equals("EntityIronGolem")) {
|
||||||
|
entitySpawnQueue.add(new SkyWars.SpawnEggInfo(p.getPosition(), mc.thePlayer.ticksExisted));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onReceivePacket(ReceivePacketEvent e) {
|
||||||
|
if (e.getPacket() instanceof S23PacketBlockChange) {
|
||||||
|
S23PacketBlockChange p = (S23PacketBlockChange) e.getPacket();
|
||||||
|
if (p.getBlockState() != null && p.getBlockState().getBlock() instanceof BlockObsidian && isNextToBed(p.getBlockPosition())) {
|
||||||
|
this.obsidianPos.put(p.getBlockPosition(), System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNextToBed(BlockPos blockPos) {
|
||||||
|
for (EnumFacing enumFacing : EnumFacing.values()) {
|
||||||
|
BlockPos offset = blockPos.offset(enumFacing);
|
||||||
|
if (BlockUtils.getBlock(offset) instanceof BlockBed) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onChat(ClientChatReceivedEvent c) {
|
public void onChat(ClientChatReceivedEvent c) {
|
||||||
if (!Utils.nullCheck()) {
|
if (!Utils.nullCheck()) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,252 @@
|
||||||
|
package keystrokesmod.module.impl.minigames;
|
||||||
|
|
||||||
|
import keystrokesmod.Raven;
|
||||||
|
import keystrokesmod.event.*;
|
||||||
|
import keystrokesmod.module.Module;
|
||||||
|
import keystrokesmod.module.impl.render.HUD;
|
||||||
|
import keystrokesmod.module.setting.impl.DescriptionSetting;
|
||||||
|
import keystrokesmod.module.setting.impl.SliderSetting;
|
||||||
|
import keystrokesmod.utility.BlockUtils;
|
||||||
|
import keystrokesmod.utility.Theme;
|
||||||
|
import keystrokesmod.utility.Utils;
|
||||||
|
import keystrokesmod.utility.command.CommandManager;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.client.C02PacketUseEntity;
|
||||||
|
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||||
|
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
|
||||||
|
import net.minecraft.network.play.client.C09PacketHeldItemChange;
|
||||||
|
import net.minecraft.network.play.server.*;
|
||||||
|
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CTWFly extends Module {
|
||||||
|
public static SliderSetting horizontalSpeed;
|
||||||
|
private SliderSetting verticalSpeed;
|
||||||
|
private SliderSetting maxFlyTicks;
|
||||||
|
private boolean d;
|
||||||
|
private boolean a = false;
|
||||||
|
|
||||||
|
private boolean begin, placed;
|
||||||
|
private int flyTicks, ticks321;
|
||||||
|
|
||||||
|
private int percent, percentDisplay;
|
||||||
|
|
||||||
|
private static int widthOffset = 55;
|
||||||
|
private static String get321 = "Waiting for explosion...";
|
||||||
|
|
||||||
|
private int color = new Color(0, 187, 255, 255).getRGB();
|
||||||
|
|
||||||
|
public CTWFly() {
|
||||||
|
super("CTW Fly", category.minigames);
|
||||||
|
this.registerSetting(new DescriptionSetting("Use TNT to fly"));
|
||||||
|
this.registerSetting(new DescriptionSetting("(High speed values will dog)"));
|
||||||
|
this.registerSetting(horizontalSpeed = new SliderSetting("Horizontal speed", 4.0, 1.0, 9.0, 0.1));
|
||||||
|
this.registerSetting(verticalSpeed = new SliderSetting("Vertical speed", 2.0, 1.0, 9.0, 0.1));
|
||||||
|
this.registerSetting(maxFlyTicks = new SliderSetting("Max fly ticks", 40, 1, 80, 1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
if (begin || placed) {
|
||||||
|
disabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onReceivePacket(ReceivePacketEvent e) {
|
||||||
|
Packet packet = e.getPacket();
|
||||||
|
|
||||||
|
if (packet instanceof S29PacketSoundEffect) {
|
||||||
|
S29PacketSoundEffect s29 = (S29PacketSoundEffect) packet;
|
||||||
|
if (!Objects.equals(String.valueOf(s29.getSoundName()), "random.explode")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mc.thePlayer.getPosition().distanceSq(s29.getX(), s29.getY(), s29.getZ()) <= 30) {
|
||||||
|
begin = true;
|
||||||
|
placed = false;
|
||||||
|
flyTicks = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onSendPacket(SendPacketEvent e) {
|
||||||
|
if (!Utils.nullCheck()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.getPacket() instanceof C08PacketPlayerBlockPlacement && Utils.holdingTNT()) {
|
||||||
|
placed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onChat(ClientChatReceivedEvent e) {
|
||||||
|
if (!Utils.nullCheck()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String stripped = Utils.stripColor(e.message.getUnformattedText());
|
||||||
|
|
||||||
|
if (stripped.contains("You cannot place blocks here!") && placed) {
|
||||||
|
disabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOWEST) // called last in order to apply fix
|
||||||
|
public void onMoveInput(PrePlayerInputEvent e) {
|
||||||
|
if (!placed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.setForward(0);
|
||||||
|
e.setStrafe(0);
|
||||||
|
Utils.setSpeed(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onPreUpdate(PreUpdateEvent e) {
|
||||||
|
if (placed) {
|
||||||
|
if (ticks321 >= 45) {
|
||||||
|
ticks321 = 0;
|
||||||
|
}
|
||||||
|
++ticks321;
|
||||||
|
}
|
||||||
|
if (!begin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.d = mc.thePlayer.capabilities.isFlying;
|
||||||
|
if (++flyTicks >= maxFlyTicks.getInput() + 1) {
|
||||||
|
disabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
double percentCalc = 1000 / maxFlyTicks.getInput();
|
||||||
|
if (percent < 1000) percent = percent + (int) percentCalc;
|
||||||
|
percentDisplay = percent / 10;
|
||||||
|
if (flyTicks >= maxFlyTicks.getInput()) percentDisplay = 100;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRenderTick(TickEvent.RenderTickEvent ev) {
|
||||||
|
if (!Utils.nullCheck() || !begin && !placed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ev.phase == TickEvent.Phase.END) {
|
||||||
|
if (mc.currentScreen != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color = Theme.getGradient((int) HUD.theme.getInput(), 0);
|
||||||
|
if (!placed) {
|
||||||
|
widthOffset = percentDisplay < 10 ? 8 : percentDisplay < 100 ? 12 : 14;
|
||||||
|
} else {
|
||||||
|
switch (ticks321) {
|
||||||
|
case 15:
|
||||||
|
get321 = "Waiting for explosion.";
|
||||||
|
widthOffset = 51;
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
get321 = "Waiting for explosion..";
|
||||||
|
widthOffset = 53;
|
||||||
|
break;
|
||||||
|
case 45:
|
||||||
|
get321 = "Waiting for explosion...";
|
||||||
|
widthOffset = 55;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String text = placed ? get321 : (percentDisplay + "%");
|
||||||
|
int width = mc.fontRendererObj.getStringWidth(text) + Utils.getBoldWidth(text) / 2;
|
||||||
|
final ScaledResolution scaledResolution = new ScaledResolution(mc);
|
||||||
|
int[] display = {scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaleFactor()};
|
||||||
|
mc.fontRendererObj.drawString(text, display[0] / 2 - width + widthOffset, display[1] / 2 + 8, color, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUpdate() {
|
||||||
|
if (!begin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mc.currentScreen == null) {
|
||||||
|
if (Utils.jumpDown()) {
|
||||||
|
mc.thePlayer.motionY = 0.3 * verticalSpeed.getInput();
|
||||||
|
}
|
||||||
|
else if (Utils.sneakDown()) {
|
||||||
|
mc.thePlayer.motionY = -0.3 * verticalSpeed.getInput();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mc.thePlayer.motionY = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mc.thePlayer.motionY = 0.0;
|
||||||
|
}
|
||||||
|
mc.thePlayer.capabilities.setFlySpeed(0.2f);
|
||||||
|
mc.thePlayer.capabilities.isFlying = true;
|
||||||
|
setSpeed(0.85 * horizontalSpeed.getInput());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void setSpeed(final double n) {
|
||||||
|
if (n == 0.0) {
|
||||||
|
mc.thePlayer.motionZ = 0;
|
||||||
|
mc.thePlayer.motionX = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double n3 = mc.thePlayer.movementInput.moveForward;
|
||||||
|
double n4 = mc.thePlayer.movementInput.moveStrafe;
|
||||||
|
float rotationYaw = mc.thePlayer.rotationYaw;
|
||||||
|
if (n3 == 0.0 && n4 == 0.0) {
|
||||||
|
mc.thePlayer.motionZ = 0;
|
||||||
|
mc.thePlayer.motionX = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (n3 != 0.0) {
|
||||||
|
if (n4 > 0.0) {
|
||||||
|
rotationYaw += ((n3 > 0.0) ? -45 : 45);
|
||||||
|
}
|
||||||
|
else if (n4 < 0.0) {
|
||||||
|
rotationYaw += ((n3 > 0.0) ? 45 : -45);
|
||||||
|
}
|
||||||
|
n4 = 0.0;
|
||||||
|
if (n3 > 0.0) {
|
||||||
|
n3 = 1.0;
|
||||||
|
}
|
||||||
|
else if (n3 < 0.0) {
|
||||||
|
n3 = -1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final double radians = Math.toRadians(rotationYaw + 90.0f);
|
||||||
|
final double sin = Math.sin(radians);
|
||||||
|
final double cos = Math.cos(radians);
|
||||||
|
mc.thePlayer.motionX = n3 * n * cos + n4 * n * sin;
|
||||||
|
mc.thePlayer.motionZ = n3 * n * sin - n4 * n * cos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void disabled() {
|
||||||
|
begin = placed = false;
|
||||||
|
if (mc.thePlayer.capabilities.allowFlying) {
|
||||||
|
mc.thePlayer.capabilities.isFlying = this.d;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mc.thePlayer.capabilities.isFlying = false;
|
||||||
|
}
|
||||||
|
this.d = false;
|
||||||
|
if (flyTicks > 0) {
|
||||||
|
mc.thePlayer.motionX = 0;
|
||||||
|
mc.thePlayer.motionY = 0;
|
||||||
|
mc.thePlayer.motionZ = 0;
|
||||||
|
}
|
||||||
|
flyTicks = percent = ticks321 = 0;
|
||||||
|
|
||||||
|
get321 = "Waiting for explosion...";
|
||||||
|
widthOffset = 55;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -234,9 +234,9 @@ public class SkyWars extends Module {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SpawnEggInfo {
|
public static class SpawnEggInfo {
|
||||||
Vec3 spawnPos;
|
public Vec3 spawnPos;
|
||||||
int tickSpawned;
|
public int tickSpawned;
|
||||||
|
|
||||||
public SpawnEggInfo(BlockPos spawnPos, int tickSpawned) {
|
public SpawnEggInfo(BlockPos spawnPos, int tickSpawned) {
|
||||||
this.spawnPos = new Vec3(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ());
|
this.spawnPos = new Vec3(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ());
|
||||||
|
|
|
||||||
|
|
@ -165,14 +165,14 @@ public class NoSlow extends Module {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPreMotion(PreMotionEvent e) {
|
public void onPreMotion(PreMotionEvent e) {
|
||||||
Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ));
|
/*Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ));
|
||||||
Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ));
|
Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ));
|
||||||
if (block instanceof BlockStairs || block instanceof BlockSlab && ModuleUtils.lastTickOnGround && ModuleUtils.lastTickPos1) {
|
if (block instanceof BlockStairs || block instanceof BlockSlab && ModuleUtils.lastTickOnGround && ModuleUtils.lastTickPos1) {
|
||||||
ticksOffStairs = 0;
|
ticksOffStairs = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ticksOffStairs++;
|
ticksOffStairs++;
|
||||||
}
|
}*/
|
||||||
if (ModuleManager.bedAura.stopAutoblock || mode.getInput() != 4) {
|
if (ModuleManager.bedAura.stopAutoblock || mode.getInput() != 4) {
|
||||||
resetFloat();
|
resetFloat();
|
||||||
return;
|
return;
|
||||||
|
|
@ -198,7 +198,6 @@ public class NoSlow extends Module {
|
||||||
offset = false;
|
offset = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Utils.sendModuleMessage(this, "Offset");
|
|
||||||
e.setPosY(e.getPosY() + ModuleUtils.offsetValue);
|
e.setPosY(e.getPosY() + ModuleUtils.offsetValue);
|
||||||
offset = true;
|
offset = true;
|
||||||
if (groundSpeedOption.isToggled()) {
|
if (groundSpeedOption.isToggled()) {
|
||||||
|
|
@ -273,7 +272,7 @@ public class NoSlow extends Module {
|
||||||
speedModifier = 0.37;
|
speedModifier = 0.37;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return speedModifier;
|
return speedModifier - 0.005;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean holdingConsumable(ItemStack itemStack) {
|
private boolean holdingConsumable(ItemStack itemStack) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package keystrokesmod.module.impl.other;
|
package keystrokesmod.module.impl.other;
|
||||||
|
|
||||||
|
import keystrokesmod.event.AntiCheatFlagEvent;
|
||||||
|
import keystrokesmod.event.ReceivePacketEvent;
|
||||||
import keystrokesmod.module.Module;
|
import keystrokesmod.module.Module;
|
||||||
import keystrokesmod.module.impl.world.AntiBot;
|
import keystrokesmod.module.impl.world.AntiBot;
|
||||||
import keystrokesmod.module.setting.impl.ButtonSetting;
|
import keystrokesmod.module.setting.impl.ButtonSetting;
|
||||||
|
|
@ -9,12 +11,14 @@ import keystrokesmod.utility.BlockUtils;
|
||||||
import keystrokesmod.utility.PlayerData;
|
import keystrokesmod.utility.PlayerData;
|
||||||
import keystrokesmod.utility.Utils;
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.block.BlockAir;
|
import net.minecraft.block.BlockAir;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.event.ClickEvent;
|
import net.minecraft.event.ClickEvent;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.ChatStyle;
|
import net.minecraft.util.ChatStyle;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
|
@ -33,9 +37,13 @@ public class Anticheat extends Module {
|
||||||
private ButtonSetting noSlow;
|
private ButtonSetting noSlow;
|
||||||
private ButtonSetting scaffold;
|
private ButtonSetting scaffold;
|
||||||
private ButtonSetting legitScaffold;
|
private ButtonSetting legitScaffold;
|
||||||
|
|
||||||
private HashMap<UUID, HashMap<ButtonSetting, Long>> flags = new HashMap<>();
|
private HashMap<UUID, HashMap<ButtonSetting, Long>> flags = new HashMap<>();
|
||||||
private HashMap<UUID, PlayerData> players = new HashMap<>();
|
private HashMap<UUID, PlayerData> players = new HashMap<>();
|
||||||
|
|
||||||
private long lastAlert;
|
private long lastAlert;
|
||||||
|
private long lastClientBoundPacket;
|
||||||
|
|
||||||
public Anticheat() {
|
public Anticheat() {
|
||||||
super("Anticheat", category.other);
|
super("Anticheat", category.other);
|
||||||
this.registerSetting(new DescriptionSetting("Tries to detect cheaters."));
|
this.registerSetting(new DescriptionSetting("Tries to detect cheaters."));
|
||||||
|
|
@ -54,6 +62,11 @@ public class Anticheat extends Module {
|
||||||
this.closetModule = true;
|
this.closetModule = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onReceivePacket(ReceivePacketEvent e) {
|
||||||
|
lastClientBoundPacket = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
private void alert(final EntityPlayer entityPlayer, ButtonSetting mode) {
|
private void alert(final EntityPlayer entityPlayer, ButtonSetting mode) {
|
||||||
if (Utils.isFriended(entityPlayer) || (ignoreTeammates.isToggled() && Utils.isTeamMate(entityPlayer))) {
|
if (Utils.isFriended(entityPlayer) || (ignoreTeammates.isToggled() && Utils.isTeamMate(entityPlayer))) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -86,6 +99,7 @@ public class Anticheat extends Module {
|
||||||
chatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wdr " + entityPlayer.getName()));
|
chatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wdr " + entityPlayer.getName()));
|
||||||
chatComponentText.appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle));
|
chatComponentText.appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle));
|
||||||
mc.thePlayer.addChatMessage(chatComponentText);
|
mc.thePlayer.addChatMessage(chatComponentText);
|
||||||
|
postAntiCheatFlagEvent(mode.getName(), entityPlayer);
|
||||||
if (shouldPing.isToggled() && Utils.timeBetween(lastAlert, currentTimeMillis) >= 1500L) {
|
if (shouldPing.isToggled() && Utils.timeBetween(lastAlert, currentTimeMillis) >= 1500L) {
|
||||||
mc.thePlayer.playSound("note.pling", 1.0f, 1.0f);
|
mc.thePlayer.playSound("note.pling", 1.0f, 1.0f);
|
||||||
lastAlert = currentTimeMillis;
|
lastAlert = currentTimeMillis;
|
||||||
|
|
@ -144,7 +158,7 @@ public class Anticheat extends Module {
|
||||||
alert(entityPlayer, legitScaffold);
|
alert(entityPlayer, legitScaffold);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (noSlow.isToggled() && playerData.noSlowTicks >= 11 && playerData.speed >= 0.08) {
|
if (noSlow.isToggled() && playerData.noSlowTicks == 11 && playerData.speed >= 0.08) {
|
||||||
alert(entityPlayer, noSlow);
|
alert(entityPlayer, noSlow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +177,7 @@ public class Anticheat extends Module {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noFall.isToggled() && !entityPlayer.capabilities.isFlying) {
|
if (noFall.isToggled() && !entityPlayer.capabilities.isFlying && Utils.timeBetween(System.currentTimeMillis(), lastClientBoundPacket) <= 150) {
|
||||||
double serverPosX = entityPlayer.serverPosX / 32;
|
double serverPosX = entityPlayer.serverPosX / 32;
|
||||||
double serverPosY = entityPlayer.serverPosY / 32;
|
double serverPosY = entityPlayer.serverPosY / 32;
|
||||||
double serverPosZ= entityPlayer.serverPosZ / 32;
|
double serverPosZ= entityPlayer.serverPosZ / 32;
|
||||||
|
|
@ -177,4 +191,8 @@ public class Anticheat extends Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postAntiCheatFlagEvent(String flag, Entity entity) {
|
||||||
|
MinecraftForge.EVENT_BUS.post(new AntiCheatFlagEvent(flag, entity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ public class NoFall extends Module {
|
||||||
private SliderSetting minFallDistance;
|
private SliderSetting minFallDistance;
|
||||||
private ButtonSetting disableAdventure;
|
private ButtonSetting disableAdventure;
|
||||||
private ButtonSetting ignoreVoid;
|
private ButtonSetting ignoreVoid;
|
||||||
private String[] modes = new String[]{"Spoof", "NoGround", "Packet A", "Packet B"};
|
private String[] modes = new String[]{"Spoof", "NoGround", "Packet A", "Packet B", "CTW Packet"};
|
||||||
|
|
||||||
private double initialY;
|
private double initialY;
|
||||||
private double dynamic;
|
private double dynamic;
|
||||||
|
|
@ -56,18 +56,19 @@ public class NoFall extends Module {
|
||||||
|
|
||||||
double predictedY = mc.thePlayer.posY + mc.thePlayer.motionY;
|
double predictedY = mc.thePlayer.posY + mc.thePlayer.motionY;
|
||||||
double distanceFallen = initialY - predictedY;
|
double distanceFallen = initialY - predictedY;
|
||||||
if (mc.thePlayer.motionY >= -2.0) {
|
if (mc.thePlayer.motionY >= -1.0) {
|
||||||
dynamic = 3.0;
|
dynamic = 3.0;
|
||||||
}
|
}
|
||||||
if (mc.thePlayer.motionY < -2.0) {
|
if (mc.thePlayer.motionY < -1.0) {
|
||||||
dynamic = 4.0;
|
dynamic = 4.0;
|
||||||
}
|
}
|
||||||
if (mc.thePlayer.motionY < -3.0) {
|
if (mc.thePlayer.motionY < -2.0) {
|
||||||
dynamic = 5.0;
|
dynamic = 5.0;
|
||||||
}
|
}
|
||||||
if (isFalling && mode.getInput() == 2) {
|
if (isFalling && mode.getInput() == 2) {
|
||||||
|
Utils.getTimer().timerSpeed = (float) 1;
|
||||||
if (distanceFallen >= dynamic) {
|
if (distanceFallen >= dynamic) {
|
||||||
Utils.getTimer().timerSpeed = (0.6799789F + (float) Utils.randomizeDouble(-0.012, 0.012));
|
Utils.getTimer().timerSpeed = (0.7199789F + (float) Utils.randomizeDouble(-0.012, 0.012));
|
||||||
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
|
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
|
||||||
initialY = mc.thePlayer.posY;
|
initialY = mc.thePlayer.posY;
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +86,14 @@ public class NoFall extends Module {
|
||||||
initialY = mc.thePlayer.posY;
|
initialY = mc.thePlayer.posY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isFalling && mode.getInput() == 4) {
|
||||||
|
Utils.getTimer().timerSpeed = (float) 1;
|
||||||
|
if (distanceFallen >= 8) {
|
||||||
|
Utils.getTimer().timerSpeed = (float) Utils.randomizeDouble(0.7, 0.70201);
|
||||||
|
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
|
||||||
|
initialY = mc.thePlayer.posY;
|
||||||
|
}
|
||||||
|
}
|
||||||
//Utils.print("" + mc.thePlayer.ticksExisted + " " + mc.thePlayer.motionY + " " + edging);
|
//Utils.print("" + mc.thePlayer.ticksExisted + " " + mc.thePlayer.motionY + " " + edging);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@ public class Scaffold extends Module {
|
||||||
private int disableTicks;
|
private int disableTicks;
|
||||||
private int scaffoldTicks;
|
private int scaffoldTicks;
|
||||||
|
|
||||||
|
private float minOffset;
|
||||||
|
|
||||||
private long firstStroke, strokeDelay = 575;
|
private long firstStroke, strokeDelay = 575;
|
||||||
private float lastEdge, lastEdge2, yawAngle;
|
private float lastEdge, lastEdge2, yawAngle;
|
||||||
|
|
||||||
|
|
@ -251,53 +253,81 @@ public class Scaffold extends Module {
|
||||||
|
|
||||||
float side = MathHelper.wrapAngleTo180_float(getMotionYaw() - yaw);
|
float side = MathHelper.wrapAngleTo180_float(getMotionYaw() - yaw);
|
||||||
float offset = yawAngle;//(!Utils.scaffoldDiagonal(false)) ? 125.500F : 143.500F;
|
float offset = yawAngle;//(!Utils.scaffoldDiagonal(false)) ? 125.500F : 143.500F;
|
||||||
float minOffset = (!Utils.scaffoldDiagonal(false)) ? 20 : 8;
|
|
||||||
float yawBackwards = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - hardcodedYaw();
|
float yawBackwards = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - hardcodedYaw();
|
||||||
float blockYawOffset = MathHelper.wrapAngleTo180_float(yawBackwards - blockYaw);
|
float blockYawOffset = MathHelper.wrapAngleTo180_float(yawBackwards - blockYaw);
|
||||||
|
int quadVal = 0;
|
||||||
|
|
||||||
float minPitch = 78.650f;
|
float minPitch = 77.650f;
|
||||||
|
|
||||||
float firstStraight = 127.50f;
|
float firstStraight = 130.50f;
|
||||||
float secondStraight = 129.50f;
|
float secondStraight = 132.50f;
|
||||||
float thirdStraight = 133.50f;
|
float thirdStraight = 134.50f;
|
||||||
float firstDiag = 134.50f;
|
float firstDiag = 135.50f;
|
||||||
float secondDiag = 135.50f;
|
float secondDiag = 137.50f;
|
||||||
float thirdDiag = 136.50f;
|
float thirdDiag = 139.50f;
|
||||||
float fourthDiag = 138f;
|
float fourthDiag = 142.50f;
|
||||||
|
|
||||||
|
float firstOffset = 23;
|
||||||
|
float secondOffset = 20;
|
||||||
|
float thirdOffset = 17;
|
||||||
|
float fourthOffset = 14;
|
||||||
|
float fifthOffset = 11;
|
||||||
|
float sixthOffset = 8;
|
||||||
|
float seventhOffset = 6;
|
||||||
|
|
||||||
//first straight
|
//first straight
|
||||||
if (quad <= 5 || quad >= 85) {
|
if (quad <= 5 || quad >= 85) {
|
||||||
yawAngle = firstStraight;
|
yawAngle = firstStraight;
|
||||||
|
minOffset = firstOffset;
|
||||||
|
quadVal = 1;
|
||||||
}
|
}
|
||||||
else if (quad > 5 || quad < 85) {
|
else if (quad > 5 || quad < 85) {
|
||||||
|
|
||||||
//second straight
|
//second straight
|
||||||
if (quad >= 80 || quad < 10) {
|
if (quad >= 80 || quad < 10) {
|
||||||
yawAngle = secondStraight;
|
yawAngle = secondStraight;
|
||||||
|
minOffset = secondOffset;
|
||||||
|
quadVal = 2;
|
||||||
|
|
||||||
//third straight
|
//third straight
|
||||||
} else if (quad >= 65 || quad < 25) {
|
} else if (quad >= 65 || quad < 25) {
|
||||||
yawAngle = thirdStraight;
|
yawAngle = thirdStraight;
|
||||||
|
minOffset = thirdOffset;
|
||||||
|
quadVal = 3;
|
||||||
|
|
||||||
//first diag
|
//first diag
|
||||||
} else if (quad >= 55 || quad < 35) {
|
} else if (quad >= 55 || quad < 35) {
|
||||||
yawAngle = firstDiag;
|
yawAngle = firstDiag;
|
||||||
|
minOffset = fourthOffset;
|
||||||
|
quadVal = 4;
|
||||||
|
|
||||||
//second diag
|
//second diag
|
||||||
} else if (quad >= 15 && quad < 45) {
|
} else if (quad >= 15 && quad < 45) {
|
||||||
yawAngle = secondDiag;
|
yawAngle = secondDiag;
|
||||||
|
minOffset = fifthOffset;
|
||||||
|
quadVal = 5;
|
||||||
if (quad >= 38) {
|
if (quad >= 38) {
|
||||||
yawAngle = thirdDiag;
|
yawAngle = thirdDiag;
|
||||||
|
minOffset = sixthOffset;
|
||||||
|
quadVal = 6;
|
||||||
if (quad >= 42) {
|
if (quad >= 42) {
|
||||||
yawAngle = fourthDiag;
|
yawAngle = fourthDiag;
|
||||||
|
minOffset = seventhOffset;
|
||||||
|
quadVal = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
yawAngle = secondDiag;
|
yawAngle = secondDiag;
|
||||||
|
minOffset = fifthOffset;
|
||||||
|
quadVal = 5;
|
||||||
if (quad >= 45 && quad < 52) {
|
if (quad >= 45 && quad < 52) {
|
||||||
yawAngle = thirdDiag;
|
yawAngle = thirdDiag;
|
||||||
|
minOffset = sixthOffset;
|
||||||
|
quadVal = 6;
|
||||||
if (quad < 48) {
|
if (quad < 48) {
|
||||||
yawAngle = fourthDiag;
|
yawAngle = fourthDiag;
|
||||||
|
minOffset = seventhOffset;
|
||||||
|
quadVal = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -338,7 +368,7 @@ public class Scaffold extends Module {
|
||||||
lastYaw + MathHelper.wrapAngleTo180_float(newYaw - lastYaw)
|
lastYaw + MathHelper.wrapAngleTo180_float(newYaw - lastYaw)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstStroke == 0 && (quad > 5 && quad < 85)) {
|
if (firstStroke == 0 && quadVal != 1) {
|
||||||
if (quad >= 0 && quad < 45) {
|
if (quad >= 0 && quad < 45) {
|
||||||
if (side >= 0) {
|
if (side >= 0) {
|
||||||
set2 = false;
|
set2 = false;
|
||||||
|
|
@ -357,7 +387,7 @@ public class Scaffold extends Module {
|
||||||
|
|
||||||
double minSwitch = (!Utils.scaffoldDiagonal(false)) ? 0 : 15;
|
double minSwitch = (!Utils.scaffoldDiagonal(false)) ? 0 : 15;
|
||||||
if (side >= 0) {
|
if (side >= 0) {
|
||||||
if (quad <= 5 || quad >= 85) {
|
if (quadVal == 1) {
|
||||||
if (yawOffset <= -minSwitch && firstStroke == 0) {
|
if (yawOffset <= -minSwitch && firstStroke == 0) {
|
||||||
set2 = false;
|
set2 = false;
|
||||||
firstStroke = Utils.time();
|
firstStroke = Utils.time();
|
||||||
|
|
@ -375,7 +405,7 @@ public class Scaffold extends Module {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (side <= -0) {
|
} else if (side <= -0) {
|
||||||
if (quad <= 5 || quad >= 85) {
|
if (quadVal == 1) {
|
||||||
if (yawOffset >= minSwitch && firstStroke == 0) {
|
if (yawOffset >= minSwitch && firstStroke == 0) {
|
||||||
set2 = false;
|
set2 = false;
|
||||||
firstStroke = Utils.time();
|
firstStroke = Utils.time();
|
||||||
|
|
@ -568,8 +598,8 @@ public class Scaffold extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
//pitch fix
|
//pitch fix
|
||||||
if (e.getPitch() >= 89.9F) {
|
if (e.getPitch() >= 89) {
|
||||||
e.setPitch(89.9F);
|
e.setPitch(89);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastYaw = mc.thePlayer.rotationYaw;
|
lastYaw = mc.thePlayer.rotationYaw;
|
||||||
|
|
@ -631,7 +661,7 @@ public class Scaffold extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disabledModule) {
|
if (disabledModule) {
|
||||||
if (hasPlaced && (towerEdge || floatStarted && Utils.isMoving() && Utils.isEdgeOfBlock())) {
|
if (hasPlaced && (towerEdge || floatStarted && Utils.isMoving())) {
|
||||||
dontDisable = true;
|
dontDisable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public class Tower extends Module {
|
||||||
if (aligned) {
|
if (aligned) {
|
||||||
if (placed) {
|
if (placed) {
|
||||||
yaw = 0;
|
yaw = 0;
|
||||||
pitch = 89.9F;
|
pitch = 89;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yaw = RotationUtils.getRotations(firstX, firstY, firstZ)[0];
|
yaw = RotationUtils.getRotations(firstX, firstY, firstZ)[0];
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class Manager extends Module {
|
||||||
Entity.clearCache();
|
Entity.clearCache();
|
||||||
NetworkPlayer.clearCache();
|
NetworkPlayer.clearCache();
|
||||||
Image.clearCache();
|
Image.clearCache();
|
||||||
|
ScriptDefaults.reloadModules();
|
||||||
if (Raven.currentProfile != null && Raven.currentProfile.getModule() != null) {
|
if (Raven.currentProfile != null && Raven.currentProfile.getModule() != null) {
|
||||||
((ProfileModule) Raven.currentProfile.getModule()).saved = false;
|
((ProfileModule) Raven.currentProfile.getModule()).saved = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class Script {
|
||||||
public String scriptName;
|
public String scriptName;
|
||||||
public String codeStr;
|
public String codeStr;
|
||||||
public boolean error = false;
|
public boolean error = false;
|
||||||
public int extraLines;
|
public int STARTING_LINE;
|
||||||
public ScriptEvents event;
|
public ScriptEvents event;
|
||||||
public File file;
|
public File file;
|
||||||
|
|
||||||
|
|
@ -28,37 +28,12 @@ public class Script {
|
||||||
this.scriptName = "sc_" + name.replace(" ", "").replace(")", "_").replace("(", "_") + "_" + Utils.generateRandomString(5);
|
this.scriptName = "sc_" + name.replace(" ", "").replace(")", "_").replace("(", "_") + "_" + Utils.generateRandomString(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] getFloat(final String s, final Object... array) {
|
|
||||||
if (this.asClass == null || this.classObject == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Method method = null;
|
|
||||||
for (final Method method2 : this.asClass.getDeclaredMethods()) {
|
|
||||||
if (method2.getName().equalsIgnoreCase(s) && method2.getParameterCount() == array.length && method2.getReturnType().equals(float[].class)) {
|
|
||||||
method = method2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (method != null) {
|
|
||||||
try {
|
|
||||||
method.setAccessible(true);
|
|
||||||
final Object invoke = method.invoke(this.classObject, array);
|
|
||||||
if (invoke instanceof float[]) {
|
|
||||||
return (float[])invoke;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException ex) {}
|
|
||||||
catch (InvocationTargetException ex2) {}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
if (this.scriptName == null || this.codeStr == null) {
|
if (this.scriptName == null || this.codeStr == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final File file = new File(Raven.scriptManager.tempDir);
|
final File file = new File(Raven.scriptManager.COMPILED_DIR);
|
||||||
if (!file.exists() || !file.isDirectory()) {
|
if (!file.exists() || !file.isDirectory()) {
|
||||||
file.mkdir();
|
file.mkdir();
|
||||||
}
|
}
|
||||||
|
|
@ -66,10 +41,10 @@ public class Script {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Diagnostic bp = new Diagnostic();
|
final Diagnostic bp = new Diagnostic();
|
||||||
final StandardJavaFileManager standardFileManager = Raven.scriptManager.compiler.getStandardFileManager(bp, null, null);
|
final StandardJavaFileManager fileManager = Raven.scriptManager.compiler.getStandardFileManager(bp, null, null);
|
||||||
final ArrayList<String> compilationOptions = new ArrayList<>();
|
final ArrayList<String> compilationOptions = new ArrayList<>();
|
||||||
compilationOptions.add("-d");
|
compilationOptions.add("-d");
|
||||||
compilationOptions.add(Raven.scriptManager.tempDir);
|
compilationOptions.add(Raven.scriptManager.COMPILED_DIR);
|
||||||
compilationOptions.add("-XDuseUnsharedTable");
|
compilationOptions.add("-XDuseUnsharedTable");
|
||||||
if (!(boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
|
if (!(boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
|
||||||
compilationOptions.add("-classpath");
|
compilationOptions.add("-classpath");
|
||||||
|
|
@ -80,7 +55,7 @@ public class Script {
|
||||||
catch (UnsupportedOperationException ex2) {}
|
catch (UnsupportedOperationException ex2) {}
|
||||||
compilationOptions.add(s);
|
compilationOptions.add(s);
|
||||||
}
|
}
|
||||||
boolean success = Raven.scriptManager.compiler.getTask(null, standardFileManager, bp, compilationOptions, null, Arrays.asList(new ClassObject(this.scriptName, this.codeStr, this.extraLines))).call();
|
boolean success = Raven.scriptManager.compiler.getTask(null, fileManager, bp, compilationOptions, null, Arrays.asList(new ClassObject(this.scriptName, this.codeStr, this.STARTING_LINE))).call();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
this.error = true;
|
this.error = true;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -90,6 +65,7 @@ public class Script {
|
||||||
this.asClass = secureClassLoader.loadClass(this.scriptName);
|
this.asClass = secureClassLoader.loadClass(this.scriptName);
|
||||||
this.classObject = this.asClass.newInstance();
|
this.classObject = this.asClass.newInstance();
|
||||||
secureClassLoader.close();
|
secureClassLoader.close();
|
||||||
|
fileManager.close();
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -124,8 +100,27 @@ public class Script {
|
||||||
return ((boolean)invoke) ? 1 : 0;
|
return ((boolean)invoke) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (IllegalAccessException | InvocationTargetException ex) {
|
||||||
printRunTimeError(e, s);
|
ReflectiveOperationException er = ex;
|
||||||
|
Utils.sendMessage("&7Runtime error during script &b" + this.name);
|
||||||
|
if (er.getCause() == null) {
|
||||||
|
Utils.sendMessage(" &7err: &cThrowable");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Utils.sendMessage(" &7err: &c" + er.getCause().getClass().getSimpleName());
|
||||||
|
final StackTraceElement[] stArr = er.getCause().getStackTrace();
|
||||||
|
if (stArr.length > 0) {
|
||||||
|
StackTraceElement st = stArr[0];
|
||||||
|
for (final StackTraceElement element : er.getCause().getStackTrace()) {
|
||||||
|
if (element.getClassName().equalsIgnoreCase(this.scriptName)) {
|
||||||
|
st = element;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Utils.sendMessage(" &7line: &c" + (st.getLineNumber() - STARTING_LINE));
|
||||||
|
Utils.sendMessage(" &7src: &c" + st.getMethodName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -134,29 +129,29 @@ public class Script {
|
||||||
public void delete() {
|
public void delete() {
|
||||||
this.asClass = null;
|
this.asClass = null;
|
||||||
this.classObject = null;
|
this.classObject = null;
|
||||||
final File file = new File(Raven.scriptManager.tempDir + File.separator + this.scriptName + ".class");
|
final File file = new File(Raven.scriptManager.COMPILED_DIR + File.separator + this.scriptName + ".class");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createScript(final String s) {
|
public void setCode(String code) {
|
||||||
extraLines = 0;
|
STARTING_LINE = 0;
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
final Iterator<String> iterator = Raven.scriptManager.imports.iterator();
|
final Iterator<String> iterator = Raven.scriptManager.imports.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
extraLines++;
|
STARTING_LINE++;
|
||||||
sb.append("import ").append(iterator.next()).append(";\n");
|
sb.append("import ").append(iterator.next()).append(";\n");
|
||||||
}
|
}
|
||||||
sb.append("import keystrokesmod.script.classes.*;\n");
|
sb.append("import keystrokesmod.script.classes.*;\n");
|
||||||
sb.append("import keystrokesmod.script.packets.clientbound.*;\n");
|
sb.append("import keystrokesmod.script.packets.clientbound.*;\n");
|
||||||
sb.append("import keystrokesmod.script.packets.serverbound.*;\n");
|
sb.append("import keystrokesmod.script.packets.serverbound.*;\n");
|
||||||
String name = Utils.extractFileName(this.name);
|
String name = Utils.extractFileName(this.name);
|
||||||
this.codeStr = sb + "public class " + this.scriptName + " extends " + ScriptDefaults.class.getName() + " {public static final " + ScriptDefaults.modules.class.getName().replace("$", ".") + " modules = new " + ScriptDefaults.modules.class.getName().replace("$", ".") + "(\"" + name + "\");public static final String scriptName = \"" + name + "\";\n" + s + "\n}";
|
this.codeStr = sb + "public class " + this.scriptName + " extends " + ScriptDefaults.class.getName() + " {public static final " + ScriptDefaults.modules.class.getName().replace("$", ".") + " modules = new " + ScriptDefaults.modules.class.getName().replace("$", ".") + "(\"" + name + "\");public static final String scriptName = \"" + name + "\";\n" + code + "\n}";
|
||||||
extraLines += 4;
|
STARTING_LINE += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean invokeMethod(final String s, final Object... array) {
|
public boolean invoke(final String s, final Object... array) {
|
||||||
if (this.asClass == null || this.classObject == null) {
|
if (this.asClass == null || this.classObject == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -173,26 +168,29 @@ public class Script {
|
||||||
method.invoke(this.classObject, array);
|
method.invoke(this.classObject, array);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (IllegalAccessException | InvocationTargetException ex) {
|
||||||
printRunTimeError(e, s);
|
ReflectiveOperationException er = ex;
|
||||||
|
Utils.sendMessage("&7Runtime error during script &b" + this.name);
|
||||||
|
if (er.getCause() == null) {
|
||||||
|
Utils.sendMessage(" &7err: &cThrowable");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Utils.sendMessage(" &7err: &c" + er.getCause().getClass().getSimpleName());
|
||||||
|
final StackTraceElement[] stArr = er.getCause().getStackTrace();
|
||||||
|
if (stArr.length > 0) {
|
||||||
|
StackTraceElement st = stArr[0];
|
||||||
|
for (final StackTraceElement element : er.getCause().getStackTrace()) {
|
||||||
|
if (element.getClassName().equalsIgnoreCase(this.scriptName)) {
|
||||||
|
st = element;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Utils.sendMessage(" &7line: &c" + (st.getLineNumber() - STARTING_LINE));
|
||||||
|
Utils.sendMessage(" &7src: &c" + st.getMethodName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLine(Throwable e, String name) {
|
|
||||||
for (StackTraceElement element : e.getStackTrace()) {
|
|
||||||
if (element.getClassName().equals(name)) {
|
|
||||||
return element.getLineNumber() - extraLines;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printRunTimeError(Exception e, String methodName) {
|
|
||||||
Utils.sendDebugMessage("§cRuntime error during script §b" + Utils.extractFileName(this.name));
|
|
||||||
Utils.sendDebugMessage(" §7err: §c" + e.getCause().getClass().getSimpleName());
|
|
||||||
Utils.sendDebugMessage(" §7line: §c" + getLine(e.getCause(), this.scriptName));
|
|
||||||
Utils.sendDebugMessage(" §7src: §c" + methodName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@ import keystrokesmod.module.Module;
|
||||||
import keystrokesmod.module.ModuleManager;
|
import keystrokesmod.module.ModuleManager;
|
||||||
import keystrokesmod.module.impl.combat.KillAura;
|
import keystrokesmod.module.impl.combat.KillAura;
|
||||||
import keystrokesmod.module.setting.Setting;
|
import keystrokesmod.module.setting.Setting;
|
||||||
import keystrokesmod.module.setting.impl.ButtonSetting;
|
import keystrokesmod.module.setting.impl.*;
|
||||||
import keystrokesmod.module.setting.impl.DescriptionSetting;
|
|
||||||
import keystrokesmod.module.setting.impl.SliderSetting;
|
|
||||||
import keystrokesmod.script.classes.*;
|
import keystrokesmod.script.classes.*;
|
||||||
import keystrokesmod.script.classes.Vec3;
|
import keystrokesmod.script.classes.Vec3;
|
||||||
import keystrokesmod.script.packets.clientbound.SPacket;
|
import keystrokesmod.script.packets.clientbound.SPacket;
|
||||||
|
|
@ -21,8 +19,7 @@ import keystrokesmod.utility.*;
|
||||||
import keystrokesmod.utility.shader.BlurUtils;
|
import keystrokesmod.utility.shader.BlurUtils;
|
||||||
import keystrokesmod.utility.shader.RoundedUtils;
|
import keystrokesmod.utility.shader.RoundedUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreenBook;
|
import net.minecraft.client.gui.*;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.client.gui.inventory.*;
|
import net.minecraft.client.gui.inventory.*;
|
||||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||||
import net.minecraft.client.renderer.*;
|
import net.minecraft.client.renderer.*;
|
||||||
|
|
@ -37,6 +34,7 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.inventory.ContainerChest;
|
import net.minecraft.inventory.ContainerChest;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.realms.RealmsBridge;
|
||||||
import net.minecraft.scoreboard.Team;
|
import net.minecraft.scoreboard.Team;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
@ -58,6 +56,17 @@ public class ScriptDefaults {
|
||||||
private static ExecutorService cachedExecutor;
|
private static ExecutorService cachedExecutor;
|
||||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
public static final Bridge bridge = new Bridge();
|
public static final Bridge bridge = new Bridge();
|
||||||
|
private static final LinkedHashMap<String, Module> modulesMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
public static void reloadModules() {
|
||||||
|
modulesMap.clear();
|
||||||
|
for (Module module : Raven.getModuleManager().getModules()) {
|
||||||
|
modulesMap.put(module.getName(), module);
|
||||||
|
}
|
||||||
|
for (Module module : Raven.scriptManager.scripts.values()) {
|
||||||
|
modulesMap.put(module.getName(), module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class client {
|
public static class client {
|
||||||
public static boolean allowFlying() {
|
public static boolean allowFlying() {
|
||||||
|
|
@ -176,6 +185,22 @@ public class ScriptDefaults {
|
||||||
mc.thePlayer.renderArmPitch = pitch;
|
mc.thePlayer.renderArmPitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void disconnect() {
|
||||||
|
boolean isLocal = mc.isIntegratedServerRunning();
|
||||||
|
boolean isRealms = mc.isConnectedToRealms();
|
||||||
|
mc.theWorld.sendQuittingDisconnectingPacket();
|
||||||
|
mc.loadWorld(null);
|
||||||
|
if (isLocal) {
|
||||||
|
mc.displayGuiScreen(new GuiMainMenu());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isRealms) {
|
||||||
|
new RealmsBridge().switchToRealms(new GuiMainMenu());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
|
||||||
|
}
|
||||||
|
|
||||||
public static float getRenderArmPitch() {
|
public static float getRenderArmPitch() {
|
||||||
return mc.thePlayer.renderArmPitch;
|
return mc.thePlayer.renderArmPitch;
|
||||||
}
|
}
|
||||||
|
|
@ -564,30 +589,15 @@ public class ScriptDefaults {
|
||||||
this.superName = superName;
|
this.superName = superName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Module getModule(String moduleName) {
|
private static Module getModule(String moduleName) {
|
||||||
for (Module module : Raven.getModuleManager().getModules()) {
|
return modulesMap.get(moduleName);
|
||||||
if (module.getName().equals(moduleName)) {
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Module module : Raven.scriptManager.scripts.values()) {
|
|
||||||
if (module.getName().equals(moduleName)) {
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Module getScript(String name) {
|
private static Module getScript(String name) {
|
||||||
for (Module module : Raven.scriptManager.scripts.values()) {
|
return modulesMap.get(name);
|
||||||
if (module.getName().equals(name)) {
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Setting getSetting(Module module, String settingName) {
|
private static Setting getSetting(Module module, String settingName) {
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -599,6 +609,22 @@ public class ScriptDefaults {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GroupSetting getGroupForString(String group) {
|
||||||
|
if (group.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<Setting> settings = getScript(this.superName).getSettings();
|
||||||
|
for (Setting setting : settings) {
|
||||||
|
if (!(setting instanceof GroupSetting)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (setting.getName().equals(group)) {
|
||||||
|
return (GroupSetting) setting;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void enable(String moduleName) {
|
public void enable(String moduleName) {
|
||||||
if (getModule(moduleName) == null) {
|
if (getModule(moduleName) == null) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -664,6 +690,14 @@ public class ScriptDefaults {
|
||||||
return new Vec3(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
return new Vec3(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isScaffolding() {
|
||||||
|
return ModuleManager.scaffold.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTowering() {
|
||||||
|
return ModuleManager.tower.canTower();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isHidden(String moduleName) {
|
public boolean isHidden(String moduleName) {
|
||||||
Module module = getModule(moduleName);
|
Module module = getModule(moduleName);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
|
|
@ -679,24 +713,52 @@ public class ScriptDefaults {
|
||||||
return new float[]{0, 0};
|
return new float[]{0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerGroup(String name) {
|
||||||
|
getScript(this.superName).registerSetting(new GroupSetting(name));
|
||||||
|
}
|
||||||
|
|
||||||
public void registerButton(String name, boolean defaultValue) {
|
public void registerButton(String name, boolean defaultValue) {
|
||||||
getScript(this.superName).registerSetting(new ButtonSetting(name, defaultValue));
|
getScript(this.superName).registerSetting(new ButtonSetting(name, defaultValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerButton(String group, String name, boolean defaultValue) {
|
||||||
|
getScript(this.superName).registerSetting(new ButtonSetting(getGroupForString(group), name, defaultValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerKey(String group, String name, int defaultKey) {
|
||||||
|
getScript(this.superName).registerSetting(new KeySetting(getGroupForString(group), name, defaultKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerKey(String name, int defaultKey) {
|
||||||
|
getScript(this.superName).registerSetting(new KeySetting(name, defaultKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
// main slider constructors
|
||||||
|
|
||||||
|
public void registerSlider(String group, String name, String suffix, double defaultValue, double minimum, double maximum, double interval) {
|
||||||
|
getScript(this.superName).registerSetting(new SliderSetting(getGroupForString(group), name, suffix, defaultValue, minimum, maximum, interval));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerSlider(String group, String name, String suffix, int defaultValue, String[] stringArray) {
|
||||||
|
getScript(this.superName).registerSetting(new SliderSetting(getGroupForString(group), name, suffix, defaultValue, stringArray));
|
||||||
|
}
|
||||||
|
|
||||||
|
// rest
|
||||||
|
|
||||||
public void registerSlider(String name, double defaultValue, double minimum, double maximum, double interval) {
|
public void registerSlider(String name, double defaultValue, double minimum, double maximum, double interval) {
|
||||||
this.registerSlider(name, "", defaultValue, minimum, maximum, interval);
|
this.registerSlider("", name, "", defaultValue, minimum, maximum, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSlider(String name, int defaultValue, String[] stringArray) {
|
public void registerSlider(String name, int defaultValue, String[] stringArray) {
|
||||||
this.registerSlider(name, "", defaultValue, stringArray);
|
this.registerSlider("", name, "", defaultValue, stringArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSlider(String name, String suffix, double defaultValue, double minimum, double maximum, double interval) {
|
public void registerSlider(String name, String suffix, double defaultValue, double minimum, double maximum, double interval) {
|
||||||
getScript(this.superName).registerSetting(new SliderSetting(name, defaultValue, minimum, maximum, interval));
|
this.registerSlider("", name, suffix, defaultValue, minimum, maximum, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSlider(String name, String suffix, int defaultValue, String[] stringArray) {
|
public void registerSlider(String name, String suffix, int defaultValue, String[] stringArray) {
|
||||||
getScript(this.superName).registerSetting(new SliderSetting(name, defaultValue, stringArray));
|
this.registerSlider("", name, suffix, defaultValue, stringArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDescription(String description) {
|
public void registerDescription(String description) {
|
||||||
|
|
@ -721,6 +783,14 @@ public class ScriptDefaults {
|
||||||
return sliderValue;
|
return sliderValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getKeyPressed(String moduleName, String name) {
|
||||||
|
KeySetting setting = ((KeySetting) getSetting(getModule(moduleName), name));
|
||||||
|
if (setting == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return setting.isPressed();
|
||||||
|
}
|
||||||
|
|
||||||
public void setButton(String moduleName, String name, boolean value) {
|
public void setButton(String moduleName, String name, boolean value) {
|
||||||
ButtonSetting setting = (ButtonSetting) getSetting(getModule(moduleName), name);
|
ButtonSetting setting = (ButtonSetting) getSetting(getModule(moduleName), name);
|
||||||
if (setting == null) {
|
if (setting == null) {
|
||||||
|
|
@ -736,6 +806,14 @@ public class ScriptDefaults {
|
||||||
}
|
}
|
||||||
setting.setValue(value);
|
setting.setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setKey(String moduleName, String name, int code) {
|
||||||
|
KeySetting setting = ((KeySetting) getSetting(getModule(moduleName), name));
|
||||||
|
if (setting == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setting.setKey(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class gl {
|
public static class gl {
|
||||||
|
|
@ -1013,10 +1091,16 @@ public class ScriptDefaults {
|
||||||
RenderUtils.drawTracerLine(entity.entity, color, lineWidth, partialTicks);
|
RenderUtils.drawTracerLine(entity.entity, color, lineWidth, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showGui() {
|
||||||
|
mc.displayGuiScreen(new EmptyGuiScreen());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class EmptyGuiScreen extends GuiScreen {
|
||||||
|
}
|
||||||
|
|
||||||
public static void item(ItemStack item, float x, float y, float scale) {
|
public static void item(ItemStack item, float x, float y, float scale) {
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
((IAccessorEntityRenderer) mc.entityRenderer).callSetupCameraTransform(((IAccessorMinecraft) mc).getTimer().renderPartialTicks, 0);
|
|
||||||
mc.entityRenderer.setupOverlayRendering();
|
mc.entityRenderer.setupOverlayRendering();
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
if (scale != 1.0f) {
|
if (scale != 1.0f) {
|
||||||
GlStateManager.scale(scale, scale, scale);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
}
|
}
|
||||||
|
|
@ -1108,8 +1192,8 @@ public class ScriptDefaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void text2d(String text, float x, float y, float scale, int color, boolean shadow) {
|
public static void text2d(String text, float x, float y, float scale, int color, boolean shadow) {
|
||||||
if (scale != 1.0f) {
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
if (scale != 1.0f) {
|
||||||
GlStateManager.scale(scale, scale, scale);
|
GlStateManager.scale(scale, scale, scale);
|
||||||
}
|
}
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
|
|
@ -1118,24 +1202,55 @@ public class ScriptDefaults {
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
if (scale != 1.0f) {
|
if (scale != 1.0f) {
|
||||||
GlStateManager.scale(1.0f, 1.0f, 1.0f);
|
GlStateManager.scale(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void text3d(String text, float x, float y, float scale, int color, boolean shadow) {
|
public static void text3d(String text, Vec3 position, float scale, boolean shadow, boolean depth, boolean background, int color) {
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
((IAccessorEntityRenderer) mc.entityRenderer).callSetupCameraTransform(((IAccessorMinecraft) mc).getTimer().renderPartialTicks, 0);
|
((IAccessorEntityRenderer) mc.entityRenderer).callSetupCameraTransform(((IAccessorMinecraft) mc).getTimer().renderPartialTicks, 0);
|
||||||
mc.entityRenderer.setupOverlayRendering();
|
GlStateManager.pushMatrix();
|
||||||
if (scale != 1.0f) {
|
float partialTicks = ((IAccessorMinecraft) mc).getTimer().renderPartialTicks;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
double px = mc.thePlayer.prevPosX + (mc.thePlayer.posX - mc.thePlayer.prevPosX) * partialTicks;
|
||||||
|
double py = mc.thePlayer.prevPosY + (mc.thePlayer.posY - mc.thePlayer.prevPosY) * partialTicks;
|
||||||
|
double pz = mc.thePlayer.prevPosZ + (mc.thePlayer.posZ - mc.thePlayer.prevPosZ) * partialTicks;
|
||||||
|
GlStateManager.translate((float)position.x - px, (float)position.y - py, (float)position.z - pz);
|
||||||
|
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f);
|
||||||
|
float f1 = 0.02666667F;
|
||||||
|
GlStateManager.scale(-f1, -f1, f1);
|
||||||
|
if (depth) {
|
||||||
|
GlStateManager.depthMask(false);
|
||||||
|
GlStateManager.disableDepth();
|
||||||
}
|
}
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
mc.fontRendererObj.drawString(text, x, y, color, shadow);
|
if (background) {
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableTexture2D();
|
||||||
if (scale != 1.0f) {
|
int width = mc.fontRendererObj.getStringWidth(text);
|
||||||
GlStateManager.scale(1.0f, 1.0f, 1.0f);
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
|
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||||
|
worldrenderer.pos(-1, -1.0, 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex();
|
||||||
|
worldrenderer.pos(-1, 8.0, 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex();
|
||||||
|
worldrenderer.pos(width + 1, 8.0, 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex();
|
||||||
|
worldrenderer.pos(width + 1, -1.0, 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
}
|
}
|
||||||
|
if (scale != 1) {
|
||||||
|
GlStateManager.scale(scale, scale, scale);
|
||||||
|
}
|
||||||
|
mc.fontRendererObj.drawString(text, 0, 0, color, shadow);
|
||||||
|
if (scale != 1) {
|
||||||
|
GlStateManager.scale(1, 1, 1);
|
||||||
|
}
|
||||||
|
if (depth) {
|
||||||
|
GlStateManager.enableDepth();
|
||||||
|
GlStateManager.depthMask(true);
|
||||||
|
}
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1402,6 +1517,10 @@ public class ScriptDefaults {
|
||||||
public static void leftClick() {
|
public static void leftClick() {
|
||||||
((IAccessorMinecraft) mc).callClickMouse();
|
((IAccessorMinecraft) mc).callClickMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getScroll() {
|
||||||
|
return Mouse.getDWheel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class util {
|
public static class util {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,11 @@ public class ScriptEvents {
|
||||||
Raven.scriptManager.invoke("onRenderTick", module, e.renderTickTime);
|
Raven.scriptManager.invoke("onRenderTick", module, e.renderTickTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
|
public void onAntiCheatFlag(AntiCheatFlagEvent e) {
|
||||||
|
Raven.scriptManager.invoke("onAntiCheatFlag", module, e.flag, Entity.convert(e.entity));
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onGuiUpdate(GuiUpdateEvent e) {
|
public void onGuiUpdate(GuiUpdateEvent e) {
|
||||||
if (e.guiScreen == null) {
|
if (e.guiScreen == null) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import keystrokesmod.module.Module;
|
||||||
import keystrokesmod.utility.NetworkUtils;
|
import keystrokesmod.utility.NetworkUtils;
|
||||||
import keystrokesmod.utility.Utils;
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
@ -32,7 +32,7 @@ public class ScriptManager {
|
||||||
public boolean deleteTempFiles = true;
|
public boolean deleteTempFiles = true;
|
||||||
public File directory;
|
public File directory;
|
||||||
public List<String> imports = Arrays.asList(Color.class.getName(), Collections.class.getName(), List.class.getName(), ArrayList.class.getName(), Arrays.class.getName(), Map.class.getName(), HashMap.class.getName(), HashSet.class.getName(), ConcurrentHashMap.class.getName(), LinkedHashMap.class.getName(), Iterator.class.getName(), Comparator.class.getName(), AtomicInteger.class.getName(), AtomicLong.class.getName(), AtomicBoolean.class.getName(), Random.class.getName(), Matcher.class.getName());
|
public List<String> imports = Arrays.asList(Color.class.getName(), Collections.class.getName(), List.class.getName(), ArrayList.class.getName(), Arrays.class.getName(), Map.class.getName(), HashMap.class.getName(), HashSet.class.getName(), ConcurrentHashMap.class.getName(), LinkedHashMap.class.getName(), Iterator.class.getName(), Comparator.class.getName(), AtomicInteger.class.getName(), AtomicLong.class.getName(), AtomicBoolean.class.getName(), Random.class.getName(), Matcher.class.getName());
|
||||||
public String tempDir = System.getProperty("java.io.tmpdir") + "cmF2ZW5fc2NyaXB0cw";
|
public String COMPILED_DIR = System.getProperty("java.io.tmpdir") + "cmF2ZW5fc2NyaXB0cw";
|
||||||
public String b = ((String[])ScriptManager.class.getProtectionDomain().getCodeSource().getLocation().getPath().split("\\.jar!"))[0].substring(5) + ".jar";
|
public String b = ((String[])ScriptManager.class.getProtectionDomain().getCodeSource().getLocation().getPath().split("\\.jar!"))[0].substring(5) + ".jar";
|
||||||
private Map<String, String> loadedHashes = new HashMap<>();
|
private Map<String, String> loadedHashes = new HashMap<>();
|
||||||
|
|
||||||
|
|
@ -43,9 +43,9 @@ public class ScriptManager {
|
||||||
public void onEnable(Script dv) {
|
public void onEnable(Script dv) {
|
||||||
if (dv.event == null) {
|
if (dv.event == null) {
|
||||||
dv.event = new ScriptEvents(getModule(dv));
|
dv.event = new ScriptEvents(getModule(dv));
|
||||||
FMLCommonHandler.instance().bus().register(dv.event);
|
MinecraftForge.EVENT_BUS.register(dv.event);
|
||||||
}
|
}
|
||||||
dv.invokeMethod("onEnable");
|
dv.invoke("onEnable");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Module getModule(Script dv) {
|
public Module getModule(Script dv) {
|
||||||
|
|
@ -64,7 +64,7 @@ public class ScriptManager {
|
||||||
|
|
||||||
if (deleteTempFiles) {
|
if (deleteTempFiles) {
|
||||||
deleteTempFiles = false;
|
deleteTempFiles = false;
|
||||||
final File tempDirectory = new File(tempDir);
|
final File tempDirectory = new File(COMPILED_DIR);
|
||||||
if (tempDirectory.exists() && tempDirectory.isDirectory()) {
|
if (tempDirectory.exists() && tempDirectory.isDirectory()) {
|
||||||
final File[] tempFiles = tempDirectory.listFiles();
|
final File[] tempFiles = tempDirectory.listFiles();
|
||||||
if (tempFiles != null) {
|
if (tempFiles != null) {
|
||||||
|
|
@ -135,6 +135,8 @@ public class ScriptManager {
|
||||||
categoryComponent.reloadModules(false);
|
categoryComponent.reloadModules(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptDefaults.reloadModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean parseFile(final File file) {
|
private boolean parseFile(final File file) {
|
||||||
|
|
@ -161,7 +163,7 @@ public class ScriptManager {
|
||||||
for (String line : topLevelLines) {
|
for (String line : topLevelLines) {
|
||||||
if (line.startsWith("load - \"") && line.endsWith("\"")) {
|
if (line.startsWith("load - \"") && line.endsWith("\"")) {
|
||||||
String url = line.substring("load - \"".length(), line.length() - 1);
|
String url = line.substring("load - \"".length(), line.length() - 1);
|
||||||
String externalContents = NetworkUtils.getTextFromURL(url, true);
|
String externalContents = NetworkUtils.getTextFromURL(url, true, true);
|
||||||
if (externalContents.isEmpty()) {
|
if (externalContents.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -173,10 +175,11 @@ public class ScriptManager {
|
||||||
}
|
}
|
||||||
Script script = new Script(scriptName);
|
Script script = new Script(scriptName);
|
||||||
script.file = file;
|
script.file = file;
|
||||||
script.createScript(scriptContents.toString());
|
script.setCode(scriptContents.toString());
|
||||||
script.run();
|
script.run();
|
||||||
Module module = new Module(script);
|
Module module = new Module(script);
|
||||||
Raven.scriptManager.scripts.put(script, module);
|
Raven.scriptManager.scripts.put(script, module);
|
||||||
|
ScriptDefaults.reloadModules();
|
||||||
Raven.scriptManager.invoke("onLoad", module);
|
Raven.scriptManager.invoke("onLoad", module);
|
||||||
return !script.error;
|
return !script.error;
|
||||||
}
|
}
|
||||||
|
|
@ -184,16 +187,16 @@ public class ScriptManager {
|
||||||
|
|
||||||
public void onDisable(Script script) {
|
public void onDisable(Script script) {
|
||||||
if (script.event != null) {
|
if (script.event != null) {
|
||||||
FMLCommonHandler.instance().bus().unregister(script.event);
|
MinecraftForge.EVENT_BUS.unregister(script.event);
|
||||||
script.event = null;
|
script.event = null;
|
||||||
}
|
}
|
||||||
script.invokeMethod("onDisable");
|
script.invoke("onDisable");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invoke(String methodName, Module module, final Object... args) {
|
public void invoke(String methodName, Module module, final Object... args) {
|
||||||
for (Map.Entry<Script, Module> entry : this.scripts.entrySet()) {
|
for (Map.Entry<Script, Module> entry : this.scripts.entrySet()) {
|
||||||
if (((entry.getValue().canBeEnabled() && entry.getValue().isEnabled()) || methodName.equals("onLoad")) && entry.getValue().equals(module)) {
|
if (((entry.getValue().canBeEnabled() && entry.getValue().isEnabled()) || methodName.equals("onLoad")) && entry.getValue().equals(module)) {
|
||||||
entry.getKey().invokeMethod(methodName, args);
|
entry.getKey().invoke(methodName, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package keystrokesmod.script.classes;
|
package keystrokesmod.script.classes;
|
||||||
|
|
||||||
import keystrokesmod.utility.BlockUtils;
|
import keystrokesmod.utility.BlockUtils;
|
||||||
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public class Block {
|
public class Block {
|
||||||
|
|
@ -32,6 +33,14 @@ public class Block {
|
||||||
this(BlockUtils.getBlock(x, y, z), new BlockPos(x, y, z));
|
this(BlockUtils.getBlock(x, y, z), new BlockPos(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Block(String name, Vec3 position) {
|
||||||
|
this(Utils.getBlockFromName(name), Vec3.getBlockPos(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block(String name) {
|
||||||
|
this(name, new Vec3(-1, -1, -1));
|
||||||
|
}
|
||||||
|
|
||||||
public Block(Vec3 position) {
|
public Block(Vec3 position) {
|
||||||
this(BlockUtils.getBlock(position.x, position.y, position.z), new BlockPos(position.x, position.y, position.z));
|
this(BlockUtils.getBlock(position.x, position.y, position.z), new BlockPos(position.x, position.y, position.z));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.projectile.EntityFishHook;
|
import net.minecraft.entity.projectile.EntityFishHook;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -270,11 +271,8 @@ public class Entity {
|
||||||
return Utils.getHorizontalSpeed(entity);
|
return Utils.getHorizontalSpeed(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getSwingProgress() {
|
public int getSwingProgress() {
|
||||||
if (!(entity instanceof EntityLivingBase)) {
|
return this.isLiving ? ((EntityLivingBase)this.entity).swingProgressInt : -1;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return ((EntityLivingBase) entity).swingProgress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTicksExisted() {
|
public int getTicksExisted() {
|
||||||
|
|
@ -305,6 +303,9 @@ public class Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCollided() {
|
public boolean isCollided() {
|
||||||
|
if (!(entity instanceof EntityPlayer)) {
|
||||||
|
return Minecraft.getMinecraft().theWorld.checkBlockCollision(this.entity.getEntityBoundingBox().expand(0.05, 0.0, 0.05));
|
||||||
|
}
|
||||||
return entity.isCollided;
|
return entity.isCollided;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,4 +37,11 @@ public class PlayerState {
|
||||||
public Object[] asArray() {
|
public Object[] asArray() {
|
||||||
return new Object[] { this.x, this.y, this.z, this.yaw, this.pitch, this.onGround, this.isSprinting, this.isSneaking };
|
return new Object[] { this.x, this.y, this.z, this.yaw, this.pitch, this.onGround, this.isSprinting, this.isSneaking };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(PlayerState playerState) {
|
||||||
|
if (playerState == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.x == playerState.x && this.y == playerState.y && this.z == playerState.z && this.yaw == playerState.yaw && this.pitch == playerState.pitch && this.onGround == playerState.onGround && this.isSprinting == playerState.isSprinting && this.isSneaking == playerState.isSneaking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,49 @@
|
||||||
package keystrokesmod.script.packets.clientbound;
|
package keystrokesmod.script.packets.clientbound;
|
||||||
|
|
||||||
import keystrokesmod.script.classes.Vec3;
|
import keystrokesmod.script.classes.Vec3;
|
||||||
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
|
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class S08 extends SPacket {
|
public class S08 extends SPacket {
|
||||||
public Vec3 position;
|
public Vec3 position;
|
||||||
public float yaw;
|
public float yaw;
|
||||||
public float pitch;
|
public float pitch;
|
||||||
|
public Set<String> enumFlags;
|
||||||
|
|
||||||
public S08(S08PacketPlayerPosLook packet) {
|
public S08(S08PacketPlayerPosLook packet) {
|
||||||
super(packet);
|
super(packet);
|
||||||
this.position = new Vec3(packet.getX(), packet.getY(), packet.getZ());
|
this.position = new Vec3(packet.getX(), packet.getY(), packet.getZ());
|
||||||
this.yaw = packet.getYaw();
|
this.yaw = packet.getYaw();
|
||||||
this.pitch = packet.getPitch();
|
this.pitch = packet.getPitch();
|
||||||
|
|
||||||
|
Set<S08PacketPlayerPosLook.EnumFlags> flags = packet.func_179834_f();
|
||||||
|
Set<String> flagsStr = new HashSet<>(flags.size());
|
||||||
|
for (S08PacketPlayerPosLook.EnumFlags flag : flags) {
|
||||||
|
flagsStr.add(flag.name());
|
||||||
|
}
|
||||||
|
this.enumFlags = flagsStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public S08(Vec3 position, float yaw, float pitch, Set<String> enumFlags) {
|
||||||
|
super(create(position, yaw, pitch, enumFlags));
|
||||||
|
this.position = position;
|
||||||
|
this.yaw = yaw;
|
||||||
|
this.pitch = pitch;
|
||||||
|
this.enumFlags = enumFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static S08PacketPlayerPosLook create(Vec3 position, float yaw, float pitch, Set<String> enumFlags) {
|
||||||
|
Set<S08PacketPlayerPosLook.EnumFlags> enumSet = EnumSet.noneOf(S08PacketPlayerPosLook.EnumFlags.class);
|
||||||
|
for (String flag : enumFlags) {
|
||||||
|
S08PacketPlayerPosLook.EnumFlags enumFlag = Utils.getEnum(S08PacketPlayerPosLook.EnumFlags.class, flag);
|
||||||
|
if (enumFlag != null) {
|
||||||
|
enumSet.add(enumFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new S08PacketPlayerPosLook(position.x, position.y, position.z, yaw, pitch, enumSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,6 @@ package keystrokesmod.script.packets.clientbound;
|
||||||
import keystrokesmod.script.classes.Block;
|
import keystrokesmod.script.classes.Block;
|
||||||
import keystrokesmod.script.classes.Vec3;
|
import keystrokesmod.script.classes.Vec3;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,43 @@ package keystrokesmod.script.packets.clientbound;
|
||||||
|
|
||||||
import keystrokesmod.script.classes.Vec3;
|
import keystrokesmod.script.classes.Vec3;
|
||||||
import net.minecraft.network.play.server.S27PacketExplosion;
|
import net.minecraft.network.play.server.S27PacketExplosion;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class S27 extends SPacket {
|
public class S27 extends SPacket {
|
||||||
public float strength;
|
public float strength;
|
||||||
public Vec3 position;
|
public Vec3 position;
|
||||||
public Vec3 motion;
|
public Vec3 motion;
|
||||||
|
public List<Vec3> affectedBlockPositions;
|
||||||
|
|
||||||
public S27(S27PacketExplosion packet) {
|
public S27(S27PacketExplosion packet) {
|
||||||
super(packet);
|
super(packet);
|
||||||
this.strength = packet.getStrength();
|
this.strength = packet.getStrength();
|
||||||
this.position = new Vec3(packet.getX(), packet.getY(), packet.getZ());
|
this.position = new Vec3(packet.getX(), packet.getY(), packet.getZ());
|
||||||
this.motion = new Vec3(packet.func_149149_c(), packet.func_149144_d(), packet.func_149147_e());
|
this.motion = new Vec3(packet.func_149149_c(), packet.func_149144_d(), packet.func_149147_e());
|
||||||
|
|
||||||
|
List<Vec3> affectedBlockPositions = new ArrayList<>();
|
||||||
|
for (BlockPos blockPos : packet.getAffectedBlockPositions()) {
|
||||||
|
affectedBlockPositions.add(Vec3.convert(blockPos));
|
||||||
|
}
|
||||||
|
this.affectedBlockPositions = affectedBlockPositions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public S27(float strength, Vec3 position, Vec3 motion, List<Vec3> affectedBlockPositions) {
|
||||||
|
super(create(strength, position, motion, affectedBlockPositions));
|
||||||
|
this.strength = strength;
|
||||||
|
this.position = position;
|
||||||
|
this.motion = motion;
|
||||||
|
this.affectedBlockPositions = affectedBlockPositions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static S27PacketExplosion create(float strength, Vec3 position, Vec3 motion, List<Vec3> affectedBlockPositions) {
|
||||||
|
List<BlockPos> list = new ArrayList<>();
|
||||||
|
for (Vec3 vec3 : affectedBlockPositions) {
|
||||||
|
list.add(Vec3.getBlockPos(vec3));
|
||||||
|
}
|
||||||
|
return new S27PacketExplosion(position.x, position.y, position.z, strength, list, Vec3.getVec3(motion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package keystrokesmod.script.packets.clientbound;
|
package keystrokesmod.script.packets.clientbound;
|
||||||
|
|
||||||
import keystrokesmod.script.classes.Vec3;
|
import keystrokesmod.script.classes.Vec3;
|
||||||
|
import keystrokesmod.utility.Utils;
|
||||||
import net.minecraft.network.play.server.S2APacketParticles;
|
import net.minecraft.network.play.server.S2APacketParticles;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
|
||||||
public class S2A extends SPacket {
|
public class S2A extends SPacket {
|
||||||
public String type;
|
public String type;
|
||||||
|
|
@ -9,15 +11,28 @@ public class S2A extends SPacket {
|
||||||
public Vec3 offset;
|
public Vec3 offset;
|
||||||
public float speed;
|
public float speed;
|
||||||
public int count;
|
public int count;
|
||||||
|
public boolean longDistance;
|
||||||
public int[] args;
|
public int[] args;
|
||||||
|
|
||||||
public S2A(S2APacketParticles packet) {
|
public S2A(S2APacketParticles packet) {
|
||||||
super(packet);
|
super(packet);
|
||||||
this.type = packet.getParticleType().name();
|
this.type = packet.getParticleType().name();
|
||||||
|
this.longDistance = packet.isLongDistance();
|
||||||
this.position = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
|
this.position = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
|
||||||
this.offset = new Vec3(packet.getXOffset(), packet.getYOffset(), packet.getZOffset());
|
this.offset = new Vec3(packet.getXOffset(), packet.getYOffset(), packet.getZOffset());
|
||||||
this.speed = packet.getParticleSpeed();
|
this.speed = packet.getParticleSpeed();
|
||||||
this.count = packet.getParticleCount();
|
this.count = packet.getParticleCount();
|
||||||
this.args = packet.getParticleArgs();
|
this.args = packet.getParticleArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public S2A(String type, boolean longDistance, Vec3 position, Vec3 offset, float speed, int count, int[] args) {
|
||||||
|
super(new S2APacketParticles(Utils.getEnum(EnumParticleTypes.class, type), longDistance, (float) position.x, (float) position.y, (float) position.z, (float) offset.x, (float) offset.y, (float) offset.z, speed, count, args));
|
||||||
|
this.type = type;
|
||||||
|
this.longDistance = longDistance;
|
||||||
|
this.position = position;
|
||||||
|
this.offset = offset;
|
||||||
|
this.speed = speed;
|
||||||
|
this.count = count;
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,18 @@ public class C03 extends CPacket {
|
||||||
public float pitch;
|
public float pitch;
|
||||||
public boolean ground;
|
public boolean ground;
|
||||||
|
|
||||||
|
protected C03(C03PacketPlayer packet, byte f1, byte f2, byte f3, byte f4, byte f5, byte f6) { // goofy asf but cba to
|
||||||
|
super(packet);
|
||||||
|
if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
|
||||||
|
this.position = new Vec3(packet.getPositionX(), packet.getPositionY(), packet.getPositionZ());
|
||||||
|
}
|
||||||
|
if (packet instanceof C03PacketPlayer.C05PacketPlayerLook || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
|
||||||
|
this.yaw = packet.getYaw();
|
||||||
|
this.pitch = packet.getPitch();
|
||||||
|
}
|
||||||
|
this.ground = packet.isOnGround();
|
||||||
|
}
|
||||||
|
|
||||||
public C03(boolean ground) {
|
public C03(boolean ground) {
|
||||||
super(new C03PacketPlayer(ground));
|
super(new C03PacketPlayer(ground));
|
||||||
this.ground = ground;
|
this.ground = ground;
|
||||||
|
|
@ -34,16 +46,4 @@ public class C03 extends CPacket {
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
this.ground = ground;
|
this.ground = ground;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected C03(C03PacketPlayer packet, byte f1, byte f2, byte f3, byte f4, byte f5, byte f6) { // goofy asf but cba to
|
|
||||||
super(packet);
|
|
||||||
if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
|
|
||||||
this.position = new Vec3(packet.getPositionX(), packet.getPositionY(), packet.getPositionZ());
|
|
||||||
}
|
|
||||||
if (packet instanceof C03PacketPlayer.C05PacketPlayerLook || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
|
|
||||||
this.yaw = packet.getYaw();
|
|
||||||
this.pitch = packet.getPitch();
|
|
||||||
}
|
|
||||||
this.ground = packet.isOnGround();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package keystrokesmod.script.packets.serverbound;
|
package keystrokesmod.script.packets.serverbound;
|
||||||
|
|
||||||
|
import keystrokesmod.script.packets.PacketMappings;
|
||||||
import keystrokesmod.script.packets.clientbound.*;
|
import keystrokesmod.script.packets.clientbound.*;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.play.client.*;
|
import net.minecraft.network.play.client.*;
|
||||||
|
|
@ -10,111 +11,53 @@ public class PacketHandler {
|
||||||
if (packet == null || packet.getClass().getSimpleName().startsWith("S")) {
|
if (packet == null || packet.getClass().getSimpleName().startsWith("S")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Class<? extends CPacket> asClass = PacketMappings.minecraftToScriptC.get(packet);
|
||||||
CPacket newPacket;
|
CPacket newPacket;
|
||||||
try {
|
if (asClass != null) {
|
||||||
if (packet instanceof C0APacketAnimation) {
|
if (packet instanceof C03PacketPlayer) {
|
||||||
newPacket = new C0A((C0APacketAnimation) packet);
|
newPacket = new C03((C03PacketPlayer)packet, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0);
|
||||||
}
|
|
||||||
else if (packet instanceof C0BPacketEntityAction) {
|
|
||||||
newPacket = new C0B((C0BPacketEntityAction) packet);
|
|
||||||
}
|
}
|
||||||
else if (packet instanceof C01PacketChatMessage) {
|
else if (packet instanceof C01PacketChatMessage) {
|
||||||
newPacket = new C01((C01PacketChatMessage)packet, (byte) 0);
|
newPacket = new C01((C01PacketChatMessage)packet, (byte) 0);
|
||||||
}
|
}
|
||||||
else if (packet instanceof C02PacketUseEntity) {
|
|
||||||
newPacket = new C02((C02PacketUseEntity)packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C0FPacketConfirmTransaction) {
|
|
||||||
newPacket = new C0F((C0FPacketConfirmTransaction) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C0EPacketClickWindow) {
|
|
||||||
newPacket = new C0E((C0EPacketClickWindow) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C03PacketPlayer) {
|
|
||||||
newPacket = new C03((C03PacketPlayer)packet, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C07PacketPlayerDigging) {
|
|
||||||
newPacket = new C07((C07PacketPlayerDigging)packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C08PacketPlayerBlockPlacement) {
|
|
||||||
newPacket = new C08((C08PacketPlayerBlockPlacement)packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C09PacketHeldItemChange) {
|
else if (packet instanceof C09PacketHeldItemChange) {
|
||||||
newPacket = new C09(((C09PacketHeldItemChange)packet), true);
|
newPacket = new C09(((C09PacketHeldItemChange)packet), true);
|
||||||
}
|
}
|
||||||
else if (packet instanceof C10PacketCreativeInventoryAction) {
|
|
||||||
newPacket = new C10((C10PacketCreativeInventoryAction) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C13PacketPlayerAbilities) {
|
|
||||||
newPacket = new C13((C13PacketPlayerAbilities) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C16PacketClientStatus) {
|
|
||||||
newPacket = new C16((C16PacketClientStatus) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof C0DPacketCloseWindow) {
|
|
||||||
newPacket = new C0D((C0DPacketCloseWindow) packet);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
|
try {
|
||||||
|
newPacket = asClass.getConstructor(net.minecraft.network.Packet.class).newInstance(packet);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
newPacket = new CPacket(packet);
|
newPacket = new CPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
}
|
||||||
ex.printStackTrace();
|
else {
|
||||||
newPacket = null;
|
newPacket = new CPacket(packet);
|
||||||
}
|
}
|
||||||
return newPacket;
|
return newPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SPacket convertClientBound(Packet packet) {
|
public static SPacket convertClientBound(Packet packet) {
|
||||||
SPacket sPacket;
|
Class<? extends SPacket> asClass = PacketMappings.minecraftToScriptS.get(packet);
|
||||||
try {
|
SPacket newPacket;
|
||||||
if (packet instanceof S12PacketEntityVelocity) {
|
if (asClass != null) {
|
||||||
sPacket = new S12((S12PacketEntityVelocity)packet);
|
if (packet instanceof S3APacketTabComplete) {
|
||||||
}
|
newPacket = new S3A((S3APacketTabComplete) packet, (byte) 0);
|
||||||
else if (packet instanceof S27PacketExplosion) {
|
|
||||||
sPacket = new S27((S27PacketExplosion)packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S3EPacketTeams) {
|
|
||||||
sPacket = new S3E((S3EPacketTeams) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S08PacketPlayerPosLook) {
|
|
||||||
sPacket = new S08((S08PacketPlayerPosLook) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S2APacketParticles) {
|
|
||||||
sPacket = new S2A((S2APacketParticles) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S06PacketUpdateHealth) {
|
|
||||||
sPacket = new S06((S06PacketUpdateHealth) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S23PacketBlockChange) {
|
|
||||||
sPacket = new S23((S23PacketBlockChange) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S29PacketSoundEffect) {
|
|
||||||
sPacket = new S29((S29PacketSoundEffect) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S2FPacketSetSlot) {
|
|
||||||
sPacket = new S2F((S2FPacketSetSlot) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S48PacketResourcePackSend) {
|
|
||||||
sPacket = new S48((S48PacketResourcePackSend) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S3APacketTabComplete) {
|
|
||||||
sPacket = new S3A((S3APacketTabComplete) packet, (byte) 0);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S02PacketChat) {
|
|
||||||
sPacket = new S02((S02PacketChat) packet);
|
|
||||||
}
|
|
||||||
else if (packet instanceof S45PacketTitle) {
|
|
||||||
sPacket = new S45((S45PacketTitle) packet);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sPacket = new SPacket(packet);
|
try {
|
||||||
|
newPacket = asClass.getConstructor(net.minecraft.network.Packet.class).newInstance(packet);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
newPacket = new SPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
|
||||||
sPacket = null;
|
|
||||||
}
|
}
|
||||||
return sPacket;
|
else {
|
||||||
|
newPacket = new SPacket(packet);
|
||||||
|
}
|
||||||
|
return newPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet convertCPacket(CPacket cPacket) {
|
public static Packet convertCPacket(CPacket cPacket) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class ModuleUtils {
|
||||||
public static int fadeEdge;
|
public static int fadeEdge;
|
||||||
public static int lastFaceDifference;
|
public static int lastFaceDifference;
|
||||||
private int lastFace;
|
private int lastFace;
|
||||||
public static float offsetValue = 1E-14F;
|
public static float offsetValue = 1E-12F;
|
||||||
public static boolean isAttacking;
|
public static boolean isAttacking;
|
||||||
private int attackingTicks;
|
private int attackingTicks;
|
||||||
private int unTargetTicks;
|
private int unTargetTicks;
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,20 @@ public class NetworkUtils {
|
||||||
public static final String CHROME_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
public static final String CHROME_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
||||||
|
|
||||||
public static boolean isHypixelKeyValid(String ak) {
|
public static boolean isHypixelKeyValid(String ak) {
|
||||||
String c = getTextFromURL("https://api.hypixel.net/key?key=" + ak, false);
|
String c = getTextFromURL("https://api.hypixel.net/key?key=" + ak, false, false);
|
||||||
return !c.isEmpty() && !c.contains("Invalid");
|
return !c.isEmpty() && !c.contains("Invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTextFromURL(String _url, boolean appendNewline) {
|
public static String getTextFromURL(String _url, boolean appendNewline, boolean sendHardwareId) {
|
||||||
String r = "";
|
String r = "";
|
||||||
HttpURLConnection con = null;
|
HttpURLConnection con = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL url = new URL(_url);
|
URL url = new URL(_url);
|
||||||
con = (HttpURLConnection) url.openConnection();
|
con = (HttpURLConnection) url.openConnection();
|
||||||
|
if (sendHardwareId) {
|
||||||
|
con.setRequestProperty("id", Utils.getHardwareIdForLoad(_url));
|
||||||
|
}
|
||||||
r = getTextFromConnection(con, appendNewline);
|
r = getTextFromConnection(con, appendNewline);
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import com.google.gson.JsonParser;
|
||||||
public class ProfileUtils {
|
public class ProfileUtils {
|
||||||
public static String getMojangProfile(String n) {
|
public static String getMojangProfile(String n) {
|
||||||
String result = "";
|
String result = "";
|
||||||
String response = NetworkUtils.getTextFromURL("https://api.mojang.com/users/profiles/minecraft/" + n, false);
|
String response = NetworkUtils.getTextFromURL("https://api.mojang.com/users/profiles/minecraft/" + n, false, false);
|
||||||
if (!response.isEmpty()) {
|
if (!response.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
result = response.split("d\":\"")[1].split("\"")[0];
|
result = response.split("d\":\"")[1].split("\"")[0];
|
||||||
|
|
@ -24,7 +24,7 @@ public class ProfileUtils {
|
||||||
s[0] = -1;
|
s[0] = -1;
|
||||||
return s;
|
return s;
|
||||||
} else {
|
} else {
|
||||||
String c = NetworkUtils.getTextFromURL("https://api.hypixel.net/player?key=" + NetworkUtils.API_KEY + "&uuid=" + u, false);
|
String c = NetworkUtils.getTextFromURL("https://api.hypixel.net/player?key=" + NetworkUtils.API_KEY + "&uuid=" + u, false, false);
|
||||||
if (c.isEmpty()) {
|
if (c.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else if (c.equals("{\"success\":true,\"player\":null}")) {
|
} else if (c.equals("{\"success\":true,\"player\":null}")) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ import java.awt.*;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.security.MessageDigest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
@ -798,6 +800,21 @@ public class Utils {
|
||||||
return Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode());
|
return Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean sneakDown() {
|
||||||
|
return Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isConsuming(Entity entity) {
|
||||||
|
if (!(entity instanceof EntityPlayer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ((EntityPlayer) entity).isUsingItem() && holdingFood((EntityPlayer) entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean holdingFood(EntityLivingBase entity) {
|
||||||
|
return entity.getHeldItem() != null && entity.getHeldItem().getItem() instanceof ItemFood;
|
||||||
|
}
|
||||||
|
|
||||||
public static double distanceToGround(Entity entity) {
|
public static double distanceToGround(Entity entity) {
|
||||||
if (entity.onGround) {
|
if (entity.onGround) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1008,6 +1025,25 @@ public class Utils {
|
||||||
return isYawDiagonal;
|
return isYawDiagonal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getHardwareIdForLoad(String url) {
|
||||||
|
String hashedId = "";
|
||||||
|
try {
|
||||||
|
MessageDigest instance = MessageDigest.getInstance("MD5");
|
||||||
|
instance.update(((System.currentTimeMillis() / 20000L + 29062381L) + "J{LlrPhHgj8zy:uB").getBytes("UTF-8"));
|
||||||
|
hashedId = String.format("%032x", new BigInteger(1, instance.digest()));
|
||||||
|
instance.update((System.getenv("COMPUTERNAME") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL") + Runtime.getRuntime().availableProcessors() + url).getBytes("UTF-8"));
|
||||||
|
return hashedId;
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return hashedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static net.minecraft.block.Block getBlockFromName(String name) {
|
||||||
|
return net.minecraft.block.Block.blockRegistry.getObject(new ResourceLocation("minecraft:" + name));
|
||||||
|
}
|
||||||
|
|
||||||
public static double gbps(Entity en, int d) {
|
public static double gbps(Entity en, int d) {
|
||||||
double x = en.posX - en.prevPosX;
|
double x = en.posX - en.prevPosX;
|
||||||
double z = en.posZ - en.prevPosZ;
|
double z = en.posZ - en.prevPosZ;
|
||||||
|
|
@ -1257,6 +1293,13 @@ public class Utils {
|
||||||
return mc.thePlayer.getHeldItem().getItem() instanceof ItemFireball;
|
return mc.thePlayer.getHeldItem().getItem() instanceof ItemFireball;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean holdingTNT() {
|
||||||
|
if (mc.thePlayer.getHeldItem() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return mc.thePlayer.getHeldItem().getDisplayName().contains("TNT");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean holdingSword(int slot) {
|
public static boolean holdingSword(int slot) {
|
||||||
ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot);
|
ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot);
|
||||||
if (stack == null || stack.getItem() == null) {
|
if (stack == null || stack.getItem() == null) {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@
|
||||||
"accessor.IAccessorEntityRenderer",
|
"accessor.IAccessorEntityRenderer",
|
||||||
"accessor.IAccessorItemFood",
|
"accessor.IAccessorItemFood",
|
||||||
"accessor.IAccessorGuiScreenBook",
|
"accessor.IAccessorGuiScreenBook",
|
||||||
|
"accessor.IAccessorGuiScreen",
|
||||||
|
"accessor.IAccessorS14PacketEntity",
|
||||||
"accessor.IAccessorEntityPlayer"
|
"accessor.IAccessorEntityPlayer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue