This commit is contained in:
jackh 2025-02-02 10:58:56 -07:00
parent bcc322cb26
commit 88f48a7454
28 changed files with 500 additions and 247 deletions

View File

@ -4,6 +4,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import keystrokesmod.event.PostProfileLoadEvent;
import keystrokesmod.keystroke.KeySrokeRenderer;
import keystrokesmod.keystroke.KeyStrokeConfigGui;
import keystrokesmod.keystroke.keystrokeCommand;
@ -145,6 +146,11 @@ public class Raven {
}
}
@SubscribeEvent
public void onPostProfileLoad(PostProfileLoadEvent e) {
clickGui.onProfileLoad();
}
public static ModuleManager getModuleManager() {
return moduleManager;
}

View File

@ -323,4 +323,12 @@ public class ClickGui extends GuiScreen {
}
return false;
}
public void onProfileLoad() {
for (CategoryComponent c : categories) {
for (ModuleComponent m : c.getModules()) {
m.onProfileLoad();
}
}
}
}

View File

@ -27,7 +27,7 @@ public class GroupComponent extends Component {
GL11.glScaled(0.5D, 0.5D, 0.5D);
float strX = (float) ((this.component.categoryComponent.getX() + 4) * 2) + 1;
float strY = (float) ((this.component.categoryComponent.getY() + this.o + 4) * 2);
if (!this.opened) {
if (this.opened) {
drawString("[", strX, strY);
int firstBracketWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth("[");
@ -39,16 +39,12 @@ public class GroupComponent extends Component {
float arrowX = firstBracketWidth - 2;
GL11.glTranslatef(arrowX + (arrowWidth / 2F), (fontHeight / 2F), 0F);
GL11.glRotatef(90F, 0F, 0F, 1F);
GL11.glTranslatef(-(arrowWidth / 2F), -(fontHeight / 2F), 0F);
drawString(">", 0, 0);
GL11.glPopMatrix();
drawString("] " + this.setting.getName(),
strX + firstBracketWidth + arrowWidth,
strY);
drawString("] " + this.setting.getName(), strX + firstBracketWidth + arrowWidth, strY);
} else {
drawString("[>] " + this.setting.getName(), strX, strY);
}

View File

@ -114,9 +114,6 @@ public class ModuleComponent extends Component {
}
RenderUtils.drawRoundedRectangle(this.categoryComponent.getX(), this.categoryComponent.getY() + yPos, this.categoryComponent.getX() + this.categoryComponent.getWidth(), this.categoryComponent.getY() + 16 + this.yPos, 8, Utils.mergeAlpha(hoverColor, (int) hoverAlpha));
}
GL11.glPushMatrix();
int button_rgb = this.mod.isEnabled() ? enabledColor : disabledColor;
if (this.mod.script != null && this.mod.script.error) {
button_rgb = invalidColor;
@ -146,8 +143,6 @@ public class ModuleComponent extends Component {
}
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.mod.getName(), (float) (this.categoryComponent.getX() + this.categoryComponent.getWidth() / 2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.mod.getName()) / 2), (float) (this.categoryComponent.getY() + this.yPos + 4), button_rgb);
GL11.glPopMatrix();
boolean scissorRequired = smoothTimer != null;
if (scissorRequired) {
GL11.glPushMatrix();
@ -200,6 +195,14 @@ public class ModuleComponent extends Component {
}
}
public void onProfileLoad() {
for (Component c : this.settings) {
if (c instanceof SliderComponent) {
((SliderComponent) c).onProfileLoad();
}
}
}
public int getModuleHeight() {
int h = 16;
Iterator var2 = this.settings.iterator();
@ -223,10 +226,8 @@ public class ModuleComponent extends Component {
}
public void drawScreen(int x, int y) {
if (!this.settings.isEmpty()) {
for (Component c : this.settings) {
c.drawScreen(x, y);
}
for (Component c : this.settings) {
c.drawScreen(x, y);
}
if (overModuleName(x, y) && this.categoryComponent.opened) {
hovering = true;

View File

@ -22,34 +22,47 @@ public class SliderComponent extends Component {
public int x;
private int y;
private boolean heldDown = false;
private double w;
private double width;
public int xOffset;
public boolean renderLine;
private double targetValue;
private double displayedValue;
private static final double SLIDER_SPEED = 0.6;
public SliderComponent(SliderSetting sliderSetting, ModuleComponent moduleComponent, int o) {
this.sliderSetting = sliderSetting;
this.moduleComponent = moduleComponent;
this.x = moduleComponent.categoryComponent.getX() + moduleComponent.categoryComponent.getWidth();
this.y = moduleComponent.categoryComponent.getY() + moduleComponent.yPos;
this.o = o;
double initial = (sliderSetting.getInput() == -1 && sliderSetting.canBeDisabled) ? -1 : sliderSetting.getInput();
this.targetValue = initial;
this.displayedValue = initial;
this.width = this.sliderSetting.getInput() == -1 ? 0 : (double) (this.moduleComponent.categoryComponent.getWidth() - 8) * (this.sliderSetting.getInput() - this.sliderSetting.getMin()) / (this.sliderSetting.getMax() - this.sliderSetting.getMin());
}
@Override
public void render() {
RenderUtils.drawRoundedRectangle(this.moduleComponent.categoryComponent.getX() + 4 + (xOffset / 2), this.moduleComponent.categoryComponent.getY() + this.o + 11, this.moduleComponent.categoryComponent.getX() + 4 + this.moduleComponent.categoryComponent.getWidth() - 8, this.moduleComponent.categoryComponent.getY() + this.o + 15, 4, -12302777);
int l = this.moduleComponent.categoryComponent.getX() + 4;
int r = this.moduleComponent.categoryComponent.getX() + 4 + (int) this.w;
if (r - l > 84) {
r = l + 84;
int left = this.moduleComponent.categoryComponent.getX() + 4 + (xOffset / 2);
int right = left + (int) this.width;
if (right - left > 84) {
right = left + 84;
}
RenderUtils.drawRoundedRectangle(l + (xOffset / 2), this.moduleComponent.categoryComponent.getY() + this.o + 11, r, this.moduleComponent.categoryComponent.getY() + this.o + 15, 4, Color.getHSBColor((float) (System.currentTimeMillis() % 11000L) / 11000.0F, 0.75F, 0.9F).getRGB());
RenderUtils.drawRoundedRectangle(left, this.moduleComponent.categoryComponent.getY() + this.o + 11, right, this.moduleComponent.categoryComponent.getY() + this.o + 15, 4, Color.getHSBColor((float) (System.currentTimeMillis() % 11000L) / 11000.0F, 0.75F, 0.9F).getRGB());
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
String value;
GL11.glScaled(0.5, 0.5, 0.5);
double input = this.sliderSetting.getInput();
String suffix = this.sliderSetting.getSuffix();
String valueText;
if (input == -1 && this.sliderSetting.canBeDisabled) {
value = "§cDisabled";
valueText = "§cDisabled";
suffix = "";
}
else {
@ -57,36 +70,49 @@ public class SliderComponent extends Component {
suffix += "s";
}
if (this.sliderSetting.isString) {
value = this.sliderSetting.getOptions()[(int) this.sliderSetting.getInput()];
int idx = (int) Math.round(input);
idx = Math.max(0, Math.min(idx, this.sliderSetting.getOptions().length - 1));
valueText = this.sliderSetting.getOptions()[idx];
}
else {
value = Utils.asWholeNum(input);
valueText = Utils.asWholeNum(input);
}
}
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.sliderSetting.getName() + ": " + (this.sliderSetting.isString ? "§e" : "§b") +value + suffix, (float) ((int) ((float) (this.moduleComponent.categoryComponent.getX() + 4) * 2.0F)) + xOffset, (float) ((int) ((float) (this.moduleComponent.categoryComponent.getY() + this.o + 3) * 2.0F)), -1);
GL11.glScaled(1, 1, 1);
if (renderLine) {
//RenderUtils.drawRectangleGL((float) ((this.moduleComponent.categoryComponent.getX() + 4) * 2), (float) ((this.moduleComponent.categoryComponent.getY() + this.o) * 2), (float) ((this.moduleComponent.categoryComponent.getX() + 4) * 2) + 1, (float) ((this.moduleComponent.categoryComponent.getY() + this.o + 4) * 2) + 22, new Color(192, 192, 192).getRGB());
}
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.sliderSetting.getName() + ": " + (this.sliderSetting.isString ? "§e" : "§b") + valueText + suffix, (float) ((this.moduleComponent.categoryComponent.getX() + 4) * 2) + xOffset, (float) ((this.moduleComponent.categoryComponent.getY() + this.o + 3) * 2), -1);
GL11.glPopMatrix();
}
public void updateHeight(int n) {
this.o = n;
}
public void drawScreen(int x, int y) {
@Override
public void drawScreen(int mouseX, int mouseY) {
this.y = this.moduleComponent.categoryComponent.getModuleY() + this.o;
this.x = this.moduleComponent.categoryComponent.getX();
double d = Math.min(this.moduleComponent.categoryComponent.getWidth() - 8, Math.max(0, x - this.x));
if (this.heldDown) {
this.moduleComponent.mod.onSlide(this.sliderSetting);
if (d == 0.0D && this.sliderSetting.canBeDisabled) {
this.sliderSetting.setValueRaw(-1);
double d = Math.min(this.moduleComponent.categoryComponent.getWidth() - 8, Math.max(0, mouseX - this.x));
if (d == 0.0 && this.sliderSetting.canBeDisabled) {
this.targetValue = -1;
}
else {
double n = roundToInterval(d / (double) (this.moduleComponent.categoryComponent.getWidth() - 8) * (this.sliderSetting.getMax() - this.sliderSetting.getMin()) + this.sliderSetting.getMin(), 4);
this.sliderSetting.setValue(n);
this.targetValue = n;
}
this.displayedValue = displayedValue + (targetValue - displayedValue) * SLIDER_SPEED;
if (targetValue == -1) {
sliderSetting.setValueRaw(-1);
}
else {
sliderSetting.setValue(this.targetValue);
}
if (this.displayedValue == -1) {
this.width = 0;
}
else {
double range = (sliderSetting.getMax() - sliderSetting.getMin());
double fraction = (this.displayedValue - sliderSetting.getMin()) / range;
this.width = (this.moduleComponent.categoryComponent.getWidth() - 8) * fraction;
}
if (this.sliderSetting.getInput() != this.sliderSetting.getMin() && ModuleManager.hud != null && ModuleManager.hud.isEnabled() && !ModuleManager.organizedModules.isEmpty()) {
@ -97,41 +123,54 @@ public class SliderComponent extends Component {
((ProfileModule) Raven.currentProfile.getModule()).saved = false;
}
}
this.w = this.sliderSetting.getInput() == -1 ? 0 : (double) (this.moduleComponent.categoryComponent.getWidth() - 8) * (this.sliderSetting.getInput() - this.sliderSetting.getMin()) / (this.sliderSetting.getMax() - this.sliderSetting.getMin());
}
private static double roundToInterval(double v, int p) {
if (p < 0) {
public void onProfileLoad() {
double initial = (sliderSetting.getInput() == -1 && sliderSetting.canBeDisabled) ? -1 : sliderSetting.getInput();
this.targetValue = initial;
this.displayedValue = initial;
this.width = this.sliderSetting.getInput() == -1 ? 0 : (double) (this.moduleComponent.categoryComponent.getWidth() - 8) * (this.sliderSetting.getInput() - this.sliderSetting.getMin()) / (this.sliderSetting.getMax() - this.sliderSetting.getMin());
}
private static double roundToInterval(double value, int places) {
if (places < 0) {
return 0.0D;
} else {
BigDecimal bd = new BigDecimal(v);
bd = bd.setScale(p, RoundingMode.HALF_UP);
}
else {
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
}
public boolean onClick(int x, int y, int b) {
if ((this.u(x, y) || this.i(x, y)) && b == 0 && this.moduleComponent.isOpened) {
@Override
public boolean onClick(int mouseX, int mouseY, int button) {
if ((u(mouseX, mouseY) || i(mouseX, mouseY)) && button == 0 && this.moduleComponent.isOpened) {
this.heldDown = true;
}
return false;
}
public void mouseReleased(int x, int y, int m) {
@Override
public void mouseReleased(int mouseX, int mouseY, int button) {
this.heldDown = false;
}
public boolean u(int x, int y) {
return x > this.x && x < this.x + this.moduleComponent.categoryComponent.getWidth() / 2 + 1 && y > this.y && y < this.y + 16;
public boolean u(int mouseX, int mouseY) {
return mouseX > this.x && mouseX < this.x + this.moduleComponent.categoryComponent.getWidth() / 2 + 1 && mouseY > this.y && mouseY < this.y + 16;
}
public boolean i(int x, int y) {
return x > this.x + this.moduleComponent.categoryComponent.getWidth() / 2 && x < this.x + this.moduleComponent.categoryComponent.getWidth() && y > this.y && y < this.y + 16;
public boolean i(int mouseX, int mouseY) {
return mouseX > this.x + this.moduleComponent.categoryComponent.getWidth() / 2 && mouseX < this.x + this.moduleComponent.categoryComponent.getWidth() && mouseY > this.y && mouseY < this.y + 16;
}
@Override
public void onGuiClosed() {
this.heldDown = false;
}
}
public void updateHeight(int n) {
this.o = n;
}
}

View File

@ -0,0 +1,11 @@
package keystrokesmod.event;
import net.minecraftforge.fml.common.eventhandler.Event;
public class PostProfileLoadEvent extends Event {
public String profileName;
public PostProfileLoadEvent(String profileName) {
this.profileName = profileName;
}
}

View File

@ -93,7 +93,7 @@ public class KillAura extends Module {
private boolean firstCycle;
private boolean partialDown;
private int partialTicks;
private int firstEdge;
private int firstEdge, firstGyatt;
private int unBlockDelay;
private boolean canBlockServerside;
private boolean checkUsing;
@ -1003,7 +1003,49 @@ public class KillAura extends Module {
case 1:
blinking.set(true);
if (ModuleUtils.isBlocked) {
if (firstEdge == 1) {
if (firstGyatt == 1) {
setSwapSlot();
swapped = true;
}
else {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
}
firstGyatt++;
if (firstGyatt > 4) {
firstGyatt = 0;
}
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 3:
firstCycle = false;
break;
}
}
else {
switch (interactTicks) {
case 1:
blinking.set(true);
if (ModuleUtils.isBlocked) {
if (firstEdge == 3) {
setSwapSlot();
swapped = true;
}
@ -1011,7 +1053,7 @@ public class KillAura extends Module {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
}
firstEdge++;
if (firstEdge > 1) {
if (firstEdge > 4) {
firstEdge = 0;
}
lag = false;
@ -1028,34 +1070,6 @@ public class KillAura extends Module {
setCurrentSlot();
swapped = false;
}
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 3:
firstCycle = false;
break;
}
}
else {
switch (interactTicks) {
case 1:
blinking.set(true);
if (ModuleUtils.isBlocked) {
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, DOWN));
lag = false;
}
else {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
releasePackets(); // release
lag = true;
}
break;
case 2:
if (!lag) {
handleInteractAndAttack(distance, true, true, swung);
sendBlockPacket();
@ -1301,7 +1315,7 @@ public class KillAura extends Module {
}
swapped = false;
lag = false;
firstEdge = interactTicks = 0;
firstEdge = firstGyatt = interactTicks = 0;
firstCycle = false;
}

View File

@ -91,7 +91,7 @@ public class BedAura extends Module {
@Override
public void onDisable() {
reset(true);
reset(true, true);
previousBlockBroken = null;
}
@ -101,14 +101,14 @@ public class BedAura extends Module {
return;
}
if (ModuleManager.bedwars != null && ModuleManager.bedwars.isEnabled() && BedWars.whitelistOwnBed.isToggled() && !BedWars.outsideSpawn) {
reset(true);
reset(true, true);
return;
}
if (Utils.isBedwarsPractice()) {
return;
}
if (!mc.thePlayer.capabilities.allowEdit || mc.thePlayer.isSpectator()) {
reset(true);
reset(true, true);
return;
}
if (bedPos == null) {
@ -117,28 +117,22 @@ public class BedAura extends Module {
bedPos = getBedPos();
}
if (bedPos == null) {
reset(true);
reset(true, true);
return;
}
}
else {
if (!(BlockUtils.getBlock(bedPos[0]) instanceof BlockBed) || (currentBlock != null && BlockUtils.replaceable(currentBlock))) {
reset(true);
reset(true, true);
return;
}
}
switch (noAutoBlockTicks) {
case -1:
resetSlot();
noAutoBlockTicks = -2;
break;
case -2:
resetSlot();
noAutoBlockTicks = -3;
break;
case -3:
noAutoBlockTicks = -4;
break;
case -4:
stopAutoblock = false;
noAutoBlockTicks = 0;
break;
@ -175,7 +169,7 @@ public class BedAura extends Module {
aiming = false;
if ((rotate || breakProgress >= 1 || breakProgress == 0) && (currentBlock != null || rotateLastBlock != null)) {
float[] rotations = RotationUtils.getRotations(currentBlock == null ? rotateLastBlock : currentBlock, e.getYaw(), e.getPitch());
if (currentBlock == null || !RotationUtils.inRange(currentBlock, range.getInput())) {
if (currentBlock != null && !RotationUtils.inRange(currentBlock, range.getInput())) {
return;
}
e.setYaw(RotationUtils.applyVanilla(rotations[0]));
@ -321,7 +315,7 @@ public class BedAura extends Module {
return efficiency;
}
private void reset(boolean resetSlot) {
private void reset(boolean resetSlot, boolean stopAutoblock) {
if (resetSlot) {
resetSlot();
}
@ -335,10 +329,11 @@ public class BedAura extends Module {
lastSlot = -1;
vanillaProgress = 0;
lastProgress = 0;
stopAutoblock = false;
noAutoBlockTicks = 0;
if (stopAutoblock) {
this.stopAutoblock = false;
noAutoBlockTicks = 0;
}
rotateLastBlock = null;
previousBlockBroken = null;
}
public void setPacketSlot(int slot) {
@ -353,7 +348,6 @@ public class BedAura extends Module {
Utils.sendModuleMessage(this, "sending c07 &astart &7break &7(&b" + mc.thePlayer.ticksExisted + "&7)");
}
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));
stopAutoblock = true;
}
private void stopBreak(BlockPos blockPos) {
@ -361,7 +355,6 @@ public class BedAura extends Module {
Utils.sendModuleMessage(this, "sending c07 &cstop &7break &7(&b" + mc.thePlayer.ticksExisted + "&7)");
}
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.UP));
stopAutoblock = false;
}
private void swing() {
@ -383,7 +376,7 @@ public class BedAura extends Module {
return;
}
if (BlockUtils.replaceable(currentBlock == null ? blockPos : currentBlock)) {
reset(true);
reset(true, true);
return;
}
currentBlock = blockPos;
@ -417,7 +410,7 @@ public class BedAura extends Module {
}
stopBreak(blockPos);
previousBlockBroken = currentBlock;
reset(false);
reset(false, false);
Iterator<Map.Entry<BlockPos, Float>> iterator = breakProgressMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<BlockPos, Float> entry = iterator.next();
@ -428,6 +421,7 @@ public class BedAura extends Module {
if (!disableBreakEffects.isToggled()) {
mc.playerController.onPlayerDestroyBlock(blockPos, EnumFacing.UP);
}
rotate = true;
rotateLastBlock = previousBlockBroken;
return;
}
@ -450,7 +444,7 @@ public class BedAura extends Module {
stopAutoblock = true; // if blocking then return and stop autoblocking
}
if (breakProgress >= lastProgress) {
rotate = true;
}
}
breakProgress += progress;

View File

@ -66,9 +66,8 @@ public class NoFall extends Module {
dynamic = 5.0;
}
if (isFalling && mode.getInput() == 2) {
Utils.getTimer().timerSpeed = (float) 1;
if (distanceFallen >= dynamic) {
Utils.getTimer().timerSpeed = (0.7199789F + (float) Utils.randomizeDouble(-0.012, 0.012));
Utils.getTimer().timerSpeed = (0.7399789F + (float) Utils.randomizeDouble(-0.012, 0.012));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
initialY = mc.thePlayer.posY;
}

View File

@ -257,23 +257,23 @@ public class Scaffold extends Module {
float blockYawOffset = MathHelper.wrapAngleTo180_float(yawBackwards - blockYaw);
int quadVal = 0;
float minPitch = 77.650f;
float minPitch = 70.650f;
float firstStraight = 130.50f;
float secondStraight = 132.50f;
float thirdStraight = 134.50f;
float firstDiag = 135.50f;
float firstStraight = 133.50f;
float secondStraight = 134.50f;
float thirdStraight = 135.50f;
float firstDiag = 136.50f;
float secondDiag = 137.50f;
float thirdDiag = 139.50f;
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;
float firstOffset = 19;
float secondOffset = 15;
float thirdOffset = 10;
float fourthOffset = 8;
float fifthOffset = 7;
float sixthOffset = 6;
float seventhOffset = 5;
//first straight
if (quad <= 5 || quad >= 85) {
@ -342,15 +342,15 @@ public class Scaffold extends Module {
pitch = blockRotations[1];
yawOffset = blockYawOffset;
if (pitch < minPitch && Utils.getHorizontalSpeed() < 0.6) {
//pitch = minPitch;
pitch = minPitch;
}
if (firstStroke == 0) {
strokeDelay = 400;
strokeDelay = 325;
}
} else {
yawOffset = minOffset;
pitch = minPitch;
strokeDelay = 600;
strokeDelay = 400;
}
if (!Utils.isMoving() || Utils.getHorizontalSpeed() == 0.0D) {
@ -598,8 +598,8 @@ public class Scaffold extends Module {
}
//pitch fix
if (e.getPitch() >= 89) {
e.setPitch(89);
if (e.getPitch() > 89.9F) {
e.setPitch(89.9F);
}
lastYaw = mc.thePlayer.rotationYaw;
@ -837,6 +837,9 @@ public class Scaffold extends Module {
if (sprint.getInput() == 0 && mc.thePlayer.onGround && !ModuleManager.tower.canTower() && !usingFastScaffold()) {
return;
}
if (ModuleManager.tower.canTower() && !ModuleManager.tower.tower) {
return;
}
if (input >= 1) {
locateAndPlaceBlock(yOffset, xOffset);
if (input >= 2) {

View File

@ -27,7 +27,7 @@ public class Tower extends Module {
private int slowTicks;
private boolean wasTowering;
private int towerTicks;
private boolean tower;
public boolean tower;
private boolean hasTowered, startedTowerInAir, setLowMotion, firstJump;
private int cMotionTicks, placeTicks;
public int dCount;
@ -57,7 +57,9 @@ public class Tower extends Module {
@SubscribeEvent
public void onPreMotion(PreMotionEvent e) {
if (canTower() && Utils.keysDown()) {
towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks;
if (tower) {
towerTicks = mc.thePlayer.onGround ? 0 : ++towerTicks;
}
switch ((int) towerMove.getInput()) {
case 1:
@ -236,7 +238,7 @@ public class Tower extends Module {
if (aligned) {
if (placed) {
yaw = 0;
pitch = 89;
pitch = 89.9F;
}
else {
yaw = RotationUtils.getRotations(firstX, firstY, firstZ)[0];
@ -268,12 +270,12 @@ public class Tower extends Module {
if (!firstJump) {
if (!mc.thePlayer.onGround) {
if (!startedTowerInAir) {
//Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel()) - 0.04);
Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel()) - 0.04);
}
startedTowerInAir = true;
}
else if (mc.thePlayer.onGround) {
//Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel()));
Utils.setSpeed(getTowerGroundSpeed(getSpeedLevel()));
firstJump = true;
}
}
@ -321,7 +323,7 @@ public class Tower extends Module {
if (!Utils.nullCheck() || !Utils.jumpDown()) {
return false;
}
else if (disableWhileHurt.isToggled() && mc.thePlayer.hurtTime > 0) {
else if (disableWhileHurt.isToggled() && ModuleUtils.damage) {
return false;
}
else if (mc.thePlayer.isCollidedHorizontally) {

View File

@ -5,20 +5,21 @@ import keystrokesmod.mixin.impl.accessor.IAccessorEntityRenderer;
import keystrokesmod.mixin.impl.accessor.IAccessorMinecraft;
import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.player.Freecam;
import keystrokesmod.module.impl.world.AntiBot;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.DescriptionSetting;
import keystrokesmod.module.setting.impl.GroupSetting;
import keystrokesmod.module.setting.impl.SliderSetting;
import keystrokesmod.utility.RenderUtils;
import keystrokesmod.utility.Utils;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -34,46 +35,71 @@ public class PlayerESP extends Module {
public SliderSetting blue;
public ButtonSetting teamColor;
public ButtonSetting rainbow;
public GroupSetting espTypes;
private ButtonSetting twoD;
private ButtonSetting box;
private ButtonSetting healthBar;
public ButtonSetting outline;
private ButtonSetting shaded;
private ButtonSetting skeleton;
private ButtonSetting ring;
public ButtonSetting redOnDamage;
public ButtonSetting renderSelf;
public ButtonSetting showInvis;
private int rgb_c = 0;
private static final float RAD_TO_DEG = 57.29578f;
private Map<EntityLivingBase, Integer> renderAsTwoD = new HashMap<>(); // entity with its rgb
// none, outline, box, shaded, 2d, ring
public PlayerESP() {
super("PlayerESP", category.render, 0);
this.registerSetting(espTypes = new GroupSetting("Types"));
this.registerSetting(twoD = new ButtonSetting(espTypes, "2D", false));
this.registerSetting(box = new ButtonSetting(espTypes, "Box", false));
this.registerSetting(outline = new ButtonSetting(espTypes, "Outline", false));
this.registerSetting(ring = new ButtonSetting(espTypes, "Ring", false));
this.registerSetting(shaded = new ButtonSetting(espTypes, "Shaded", false));
this.registerSetting(skeleton = new ButtonSetting(espTypes, "Skeleton", false));
this.registerSetting(red = new SliderSetting("Red", 0.0D, 0.0D, 255.0D, 1.0D));
this.registerSetting(green = new SliderSetting("Green", 255.0D, 0.0D, 255.0D, 1.0D));
this.registerSetting(blue = new SliderSetting("Blue", 0.0D, 0.0D, 255.0D, 1.0D));
this.registerSetting(rainbow = new ButtonSetting("Rainbow", false));
this.registerSetting(teamColor = new ButtonSetting("Team color", false));
this.registerSetting(new DescriptionSetting("ESP Types"));
this.registerSetting(twoD = new ButtonSetting("2D", false));
this.registerSetting(box = new ButtonSetting("Box", false));
this.registerSetting(healthBar = new ButtonSetting("Health bar", true));
this.registerSetting(outline = new ButtonSetting("Outline", false));
this.registerSetting(ring = new ButtonSetting("Ring", false));
this.registerSetting(shaded = new ButtonSetting("Shaded", false));
this.registerSetting(redOnDamage = new ButtonSetting("Red on damage", true));
this.registerSetting(renderSelf = new ButtonSetting("Render self", false));
this.registerSetting(teamColor = new ButtonSetting("Team color", false));
this.registerSetting(showInvis = new ButtonSetting("Show invis", true));
}
public void onDisable() {
RenderUtils.ring_c = false;
}
public void guiUpdate() {
this.rgb_c = (new Color((int) red.getInput(), (int) green.getInput(), (int) blue.getInput())).getRGB();
}
@SubscribeEvent
public void onRenderPlayerEvent(RenderPlayerEvent.Post e) {
if (skeleton.isToggled() && e.entityPlayer != null && Utils.nullCheck()) {
EntityPlayer player = e.entityPlayer;
if (player != mc.thePlayer || (renderSelf.isToggled() && mc.gameSettings.thirdPersonView > 0)) {
if (player.deathTime != 0) {
return;
}
if (!showInvis.isToggled() && player.isInvisible()) {
return;
}
if (mc.thePlayer != player && AntiBot.isBot(player)) {
return;
}
int rgb = rainbow.isToggled() ? Utils.getChroma(2L, 0L) : this.rgb_c;
if (teamColor.isToggled()) {
rgb = Utils.getColorFromEntity(player);
}
this.renderSkeleton(e.entityPlayer, e.renderer.getMainModel(), rgb, e.partialRenderTick);
}
}
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onRenderWorld(RenderWorldLastEvent e) {
this.renderAsTwoD.clear();
@ -83,7 +109,7 @@ public class PlayerESP extends Module {
for (final Entity entity : mc.theWorld.loadedEntityList) {
if (entity instanceof EntityLivingBase && entity != mc.thePlayer) {
if (teamColor.isToggled()) {
rgb = getColorFromTags(entity);
rgb = Utils.getColorFromEntity(entity);
}
this.render(entity, rgb);
this.renderAsTwoD.put((EntityLivingBase) entity, rgb);
@ -91,19 +117,20 @@ public class PlayerESP extends Module {
}
return;
}
EntityPlayer selfPlayer = (Freecam.freeEntity == null) ? mc.thePlayer : Freecam.freeEntity;
for (EntityPlayer player : mc.theWorld.playerEntities) {
if (player != mc.thePlayer || (renderSelf.isToggled() && mc.gameSettings.thirdPersonView > 0)) {
if (player != selfPlayer || (renderSelf.isToggled() && mc.gameSettings.thirdPersonView > 0)) {
if (player.deathTime != 0) {
continue;
}
if (!showInvis.isToggled() && player.isInvisible()) {
continue;
}
if (mc.thePlayer != player && AntiBot.isBot(player)) {
if (selfPlayer != player && AntiBot.isBot(player)) {
continue;
}
if (teamColor.isToggled()) {
rgb = getColorFromTags(player);
rgb = Utils.getColorFromEntity(player);
}
this.render(player, rgb);
this.renderAsTwoD.put(player, rgb);
@ -142,56 +169,6 @@ public class PlayerESP extends Module {
}
}
public int getColorFromTags(Entity entity) {
if (entity instanceof EntityPlayer) {
ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)((EntityLivingBase) entity).getTeam();
if (scoreplayerteam != null) {
String s = FontRenderer.getFormatFromString(scoreplayerteam.getColorPrefix());
if (s.length() >= 2) {
return mc.getRenderManager().getFontRenderer().getColorCode(s.charAt(1));
}
}
}
String displayName = entity.getDisplayName().getFormattedText();
displayName = Utils.removeFormatCodes(displayName);
if (displayName.isEmpty() || !displayName.startsWith("§") || displayName.charAt(1) == 'f') {
return -1;
}
switch (displayName.charAt(1)) {
case '0':
return -16777216;
case '1':
return -16777046;
case '2':
return -16733696;
case '3':
return -16733526;
case '4':
return -5636096;
case '5':
return -5635926;
case '6':
return -22016;
case '7':
return -5592406;
case '8':
return -11184811;
case '9':
return -11184641;
case 'a':
return -11141291;
case 'b':
return -11141121;
case 'c':
return -43691;
case 'd':
return -43521;
case 'e':
return -171;
}
return -1;
}
public void renderTwoD(EntityLivingBase en, int rgb, double expand, float partialTicks) {
if (!RenderUtils.isInViewFrustum(en)) {
return;
@ -312,4 +289,147 @@ public class PlayerESP extends Module {
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}
public void renderSkeleton(EntityPlayer player, ModelBiped modelBiped, int color, float partialTicks) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_DEPTH_TEST);
double viewerPosX = mc.getRenderManager().viewerPosX;
double viewerPosY = mc.getRenderManager().viewerPosY;
double viewerPosZ = mc.getRenderManager().viewerPosZ;
double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks - viewerPosX;
double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks - viewerPosY;
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks - viewerPosZ;
boolean wasBlendEnabled = GL11.glIsEnabled(GL11.GL_BLEND);
GL11.glPushMatrix();
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (!wasBlendEnabled) {
GL11.glEnable(GL11.GL_BLEND);
}
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f((float) (color >> 16 & 0xFF) / 255.0f, (float) (color >> 8 & 0xFF) / 255.0f, (float) (color & 0xFF) / 255.0f, 1.0f);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glTranslated(posX, posY, posZ);
float distance = mc.thePlayer.getDistanceToEntity(player);
float computedLineWidth = 4.0f * ((100.0f - Math.min(distance, 100.0f)) / 100.0f);
float lineWidth = Math.max(1.0f, computedLineWidth);
GL11.glLineWidth(lineWidth);
boolean isSneaking = player.isSneaking();
float legHeight = isSneaking ? 0.6f : 0.75f;
double legOffsetZ = isSneaking ? -0.2 : 0.0;
GL11.glRotatef(player.renderYawOffset, 0.0f, -999.0f, 0.0f);
GL11.glTranslated(-0.15, legHeight, legOffsetZ);
// Render the right leg
float rightLegRotX = modelBiped.bipedRightLeg.rotateAngleX * RAD_TO_DEG;
float rightLegRotY = modelBiped.bipedRightLeg.rotateAngleY * RAD_TO_DEG;
float rightLegRotZ = modelBiped.bipedRightLeg.rotateAngleZ * RAD_TO_DEG;
GL11.glRotatef(rightLegRotX, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(-rightLegRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-rightLegRotZ, 0.0f, 0.0f, 1.0f);
drawLine(0.0, 0.0, 0.0, 0.0, -legHeight, 0.0);
// Undo the right leg rotations.
GL11.glRotatef(rightLegRotZ, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(rightLegRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-rightLegRotX, 1.0f, 0.0f, 0.0f);
// Render left leg
GL11.glTranslated(0.3, 0.0, 0.0);
float leftLegRotX = modelBiped.bipedLeftLeg.rotateAngleX * RAD_TO_DEG;
float leftLegRotY = modelBiped.bipedLeftLeg.rotateAngleY * RAD_TO_DEG;
float leftLegRotZ = modelBiped.bipedLeftLeg.rotateAngleZ * RAD_TO_DEG;
GL11.glRotatef(leftLegRotX, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(-leftLegRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-leftLegRotZ, 0.0f, 0.0f, 1.0f);
drawLine(0.0, 0.0, 0.0, 0.0, -legHeight, 0.0);
// Undo the left leg rotations.
GL11.glRotatef(leftLegRotZ, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(leftLegRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-leftLegRotX, 1.0f, 0.0f, 0.0f);
GL11.glTranslated(-0.15, 0.0, 0.0);
// Draw a line connecting the legs.
drawLine(0.15, 0.0, 0.0, -0.15, 0.0, 0.0);
// Renders the torso
if (player.isSneaking()) {
GL11.glRotatef(20.0f, 1.0f, 0.0f, 0.0f);
}
drawLine(0.0, 0.0, 0.0, 0.0, 0.65, 0.0);
// Move to the top of the torso (shoulder level) and draw shoulders.
GL11.glTranslated(0.0, 0.65, 0.0);
drawLine(0.35, 0.0, 0.0, -0.35, 0.0, 0.0);
GL11.glTranslated(-0.35, 0.0, 0.0);
// Render right arm
float rightArmRotX = modelBiped.bipedRightArm.rotateAngleX * RAD_TO_DEG;
float rightArmRotY = modelBiped.bipedRightArm.rotateAngleY * RAD_TO_DEG;
float rightArmRotZ = modelBiped.bipedRightArm.rotateAngleZ * RAD_TO_DEG;
GL11.glRotatef(rightArmRotX, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(-rightArmRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-rightArmRotZ, 0.0f, 0.0f, 1.0f);
drawLine(0.0, 0.0, 0.0, 0.0, -0.6, 0.0);
// Undo the right arm rotations.
GL11.glRotatef(rightArmRotZ, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(rightArmRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-rightArmRotX, 1.0f, 0.0f, 0.0f);
// Render left arm
GL11.glTranslated(0.7, 0.0, 0.0);
float leftArmRotX = modelBiped.bipedLeftArm.rotateAngleX * RAD_TO_DEG;
float leftArmRotY = modelBiped.bipedLeftArm.rotateAngleY * RAD_TO_DEG;
float leftArmRotZ = modelBiped.bipedLeftArm.rotateAngleZ * RAD_TO_DEG;
GL11.glRotatef(leftArmRotX, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(-leftArmRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-leftArmRotZ, 0.0f, 0.0f, 1.0f);
drawLine(0.0, 0.0, 0.0, 0.0, -0.6, 0.0);
// Undo the left arm rotations.
GL11.glRotatef(leftArmRotZ, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(leftArmRotY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-leftArmRotX, 1.0f, 0.0f, 0.0f);
GL11.glTranslated(-0.35, 0.0, 0.0);
// renders head
// undo the torso rotation.
GL11.glRotatef(-player.renderYawOffset, 0.0f, -999.0f, 0.0f);
double headHeight = 0.4;
GL11.glRotated(player.rotationYaw, 0.0, -999.0, 0.0);
GL11.glRotated(player.rotationPitch, 999.0, 0.0, 0.0);
drawLine(0.0, 0.0, 0.0, 0.0, headHeight, 0.0);
drawLine(0.0, headHeight, 0.0, 0.0, headHeight, 0.25);
GL11.glRotated(player.rotationPitch, 999.0, 0.0, 0.0);
GL11.glRotated(-player.rotationYaw, 0.0, 999.0, 0.0);
if (!wasBlendEnabled) {
GL11.glDisable(GL11.GL_BLEND);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
GL11.glColor4f(1, 1, 1,1);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glPopMatrix();
}
private void drawLine(double x1, double y1, double z1, double x2, double y2, double z2) {
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex3d(x1, y1, z1);
GL11.glVertex3d(x2, y2, z2);
GL11.glEnd();
}
}

View File

@ -18,6 +18,7 @@ import keystrokesmod.script.packets.serverbound.PacketHandler;
import keystrokesmod.utility.*;
import keystrokesmod.utility.shader.BlurUtils;
import keystrokesmod.utility.shader.RoundedUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.inventory.*;
@ -495,21 +496,20 @@ public class ScriptDefaults {
}
public static class world {
public static Block getBlockAt(int x, int y, int z) {
net.minecraft.block.Block block = BlockUtils.getBlock(new BlockPos(x, y, z));
if (block == null) {
IBlockState state = BlockUtils.getBlockState(new BlockPos(x, y, z));
if (state == null) {
return new Block(Blocks.air, new BlockPos(x, y, z));
}
return new Block(block, new BlockPos(x, y, z));
return new Block(state, new BlockPos(x, y, z));
}
public static Block getBlockAt(Vec3 pos) {
net.minecraft.block.Block block = BlockUtils.getBlock(new BlockPos(pos.x, pos.y, pos.z));
if (block == null) {
IBlockState state = BlockUtils.getBlockState(new BlockPos(pos.x, pos.y, pos.z));
if (state == null) {
return new Block(Blocks.air, new BlockPos(pos.x, pos.y, pos.z));
}
return new Block(block, new BlockPos(pos.x, pos.y, pos.z));
return new Block(state, new BlockPos(pos.x, pos.y, pos.z));
}
public static String getDimension() {

View File

@ -2,6 +2,7 @@ package keystrokesmod.script.classes;
import keystrokesmod.utility.BlockUtils;
import keystrokesmod.utility.Utils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
public class Block {
@ -29,6 +30,20 @@ public class Block {
this.z = blockPos.getZ();
}
public Block(IBlockState state, BlockPos blockPos) {
final net.minecraft.block.Block block = state.getBlock();
this.type = block.getClass().getSimpleName();
this.name = block.getRegistryName().replace("minecraft:", "");
this.interactable = BlockUtils.isInteractable(block);
this.variant = block.getMetaFromState(state);
this.height = block.getBlockBoundsMaxY() - block.getBlockBoundsMinY();
this.width = block.getBlockBoundsMaxX() - block.getBlockBoundsMinX();
this.length = block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ();
this.x = blockPos.getX();
this.y = blockPos.getY();
this.z = blockPos.getZ();
}
public Block(int x, int y, int z) {
this(BlockUtils.getBlock(x, y, z), new BlockPos(x, y, z));
}

View File

@ -208,7 +208,7 @@ public class Entity {
}
public boolean isConsuming() {
return this.entity.isEating();
return Utils.isConsuming(this.entity);
}
public Vec3 getLastPosition() {

View File

@ -10,10 +10,10 @@ public class S23 extends SPacket {
public Vec3 position;
public Block block;
public S23(S23PacketBlockChange packet) {
public S23(S23PacketBlockChange packet, byte f) {
super(packet);
this.position = Vec3.convert(packet.getBlockPosition());
this.block = new Block(packet.getBlockState().getBlock(), new BlockPos(position.x, position.y, position.z));
this.block = new Block(packet.getBlockState(), new BlockPos(position.x, position.y, position.z));
}
public S23(Vec3 position) {

View File

@ -9,7 +9,7 @@ public class C03 extends CPacket {
public float pitch;
public boolean ground;
protected C03(C03PacketPlayer packet, byte f1, byte f2, byte f3, byte f4, byte f5, byte f6) { // goofy asf but cba to
public 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());

View File

@ -18,7 +18,7 @@ public class C07 extends CPacket {
this.facing = facing;
}
protected C07(C07PacketPlayerDigging packet) {
public C07(C07PacketPlayerDigging packet) {
super(packet);
this.position = Vec3.convert(packet.getPosition());
this.status = packet.getStatus().name();

View File

@ -10,7 +10,7 @@ public class C09 extends CPacket {
this.slot = slot;
}
protected C09(C09PacketHeldItemChange packet, boolean identifier) {
public C09(C09PacketHeldItemChange packet, boolean identifier) {
super(packet);
this.slot = packet.getSlotId();
}

View File

@ -3,7 +3,7 @@ package keystrokesmod.script.packets.serverbound;
import net.minecraft.network.play.client.C0APacketAnimation;
public class C0A extends CPacket {
protected C0A(C0APacketAnimation packet) {
public C0A(C0APacketAnimation packet) {
super(packet);
}

View File

@ -9,7 +9,7 @@ public class C0D extends CPacket {
this.windowId = windowId;
}
protected C0D(C0DPacketCloseWindow packet) {
public C0D(C0DPacketCloseWindow packet) {
super(packet);
}

View File

@ -13,7 +13,7 @@ public class C10 extends CPacket {
this.itemStack = itemStack;
}
protected C10(C10PacketCreativeInventoryAction packet) {
public C10(C10PacketCreativeInventoryAction packet) {
super(packet);
this.slot = packet.getSlotId();
this.itemStack = ItemStack.convert(packet.getStack());

View File

@ -21,7 +21,7 @@ public class C13 extends CPacket {
this.walkSpeed = walkSpeed;
}
protected C13(C13PacketPlayerAbilities packet) {
public C13(C13PacketPlayerAbilities packet) {
super(packet);
}

View File

@ -11,7 +11,7 @@ public class C16 extends CPacket {
this.status = status;
}
protected C16(C16PacketClientStatus packet) {
public C16(C16PacketClientStatus packet) {
super(packet);
this.status = packet.getStatus().name();
}

View File

@ -11,7 +11,7 @@ public class PacketHandler {
if (packet == null || packet.getClass().getSimpleName().startsWith("S")) {
return null;
}
Class<? extends CPacket> asClass = PacketMappings.minecraftToScriptC.get(packet);
Class<? extends CPacket> asClass = PacketMappings.minecraftToScriptC.get(packet.getClass());
CPacket newPacket;
if (asClass != null) {
if (packet instanceof C03PacketPlayer) {
@ -25,7 +25,7 @@ public class PacketHandler {
}
else {
try {
newPacket = asClass.getConstructor(net.minecraft.network.Packet.class).newInstance(packet);
newPacket = asClass.getConstructor(packet.getClass()).newInstance(packet);
}
catch (Exception e) {
newPacket = new CPacket(packet);
@ -39,15 +39,18 @@ public class PacketHandler {
}
public static SPacket convertClientBound(Packet packet) {
Class<? extends SPacket> asClass = PacketMappings.minecraftToScriptS.get(packet);
Class<? extends SPacket> asClass = PacketMappings.minecraftToScriptS.get(packet.getClass());
SPacket newPacket;
if (asClass != null) {
if (packet instanceof S3APacketTabComplete) {
newPacket = new S3A((S3APacketTabComplete) packet, (byte) 0);
}
else if (packet instanceof S23PacketBlockChange) {
newPacket = new S23((S23PacketBlockChange) packet, (byte) 0);
}
else {
try {
newPacket = asClass.getConstructor(net.minecraft.network.Packet.class).newInstance(packet);
newPacket = asClass.getConstructor(packet.getClass()).newInstance(packet);
}
catch (Exception e) {
newPacket = new SPacket(packet);

View File

@ -1,16 +1,15 @@
package keystrokesmod.utility;
import keystrokesmod.event.NoEventPacketEvent;
import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.event.SendPacketEvent;
import keystrokesmod.event.*;
import keystrokesmod.module.impl.movement.LongJump;
import keystrokesmod.module.impl.render.HUD;
import keystrokesmod.utility.command.CommandManager;
import net.minecraft.client.Minecraft;
import keystrokesmod.module.ModuleManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.S12PacketEntityVelocity;
import net.minecraft.network.play.server.S27PacketExplosion;
import net.minecraft.util.BlockPos;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
@ -49,6 +48,9 @@ public class ModuleUtils {
public static boolean isBlocked;
public static boolean damage;
private int damageTicks;
@SubscribeEvent
public void onSendPacketNoEvent(NoEventPacketEvent e) {
if (!Utils.nullCheck()) {
@ -155,9 +157,29 @@ public class ModuleUtils {
}
@SubscribeEvent
public void onReceivePacket(ReceivePacketEvent e) {
if (!Utils.nullCheck()) {
return;
}
if (e.getPacket() instanceof S12PacketEntityVelocity) {
if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) {
damage = true;
damageTicks = 0;
}
}
}
@SubscribeEvent
public void onPreUpdate(PreUpdateEvent e) {
if (damage && ++damageTicks >= 8) {
damage = false;
damageTicks = 0;
}
profileTicks++;
if (isAttacking) {

View File

@ -58,6 +58,22 @@ public class Utils {
public static HashSet<String> enemies = new HashSet<>();
public static final Logger log = LogManager.getLogger();
private static int darkRed = new Color(189, 0, 1).getRGB();
private static int red = new Color(253, 63, 63).getRGB();
private static int gold = new Color(215, 162, 50).getRGB();
private static int yellow = new Color(254, 254, 62).getRGB();
private static int darkGreen = new Color(0, 191, 4).getRGB();
private static int green = new Color(64, 253, 62).getRGB();
private static int aqua = new Color(65, 255, 254).getRGB();
private static int darkAqua = new Color(0, 190, 189).getRGB();
private static int darkBlue = new Color(1, 1, 187).getRGB();
private static int blue = new Color(61, 64, 255).getRGB();
private static int lightPurple = new Color(254, 63, 255).getRGB();
private static int darkPurple = new Color(190, 0, 190).getRGB();
private static int gray = new Color(190, 190, 190).getRGB();
private static int darkGray = new Color(63, 63, 63).getRGB();
private static int black = new Color(17, 17, 17).getRGB();
public static boolean addEnemy(String name) {
if (enemies.add(name.toLowerCase())) {
Utils.sendMessage("&7Added &cenemy&7: &b" + name);
@ -1356,35 +1372,35 @@ public class Utils {
}
switch (displayName.charAt(1)) {
case '0':
return -16777216;
return black;
case '1':
return -16777046;
return darkBlue;
case '2':
return -16733696;
return darkGreen;
case '3':
return -16733526;
return darkAqua;
case '4':
return -5636096;
return darkRed;
case '5':
return -5635926;
return darkPurple;
case '6':
return -22016;
return gold;
case '7':
return -5592406;
return gray;
case '8':
return -11184811;
return darkGray;
case '9':
return -11184641;
return blue;
case 'a':
return -11141291;
return green;
case 'b':
return -11141121;
return aqua;
case 'c':
return -43691;
return red;
case 'd':
return -43521;
return lightPurple;
case 'e':
return -171;
return yellow;
}
return -1;
}

View File

@ -4,6 +4,7 @@ import com.google.gson.*;
import keystrokesmod.Raven;
import keystrokesmod.clickgui.ClickGui;
import keystrokesmod.clickgui.components.impl.CategoryComponent;
import keystrokesmod.event.PostProfileLoadEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.client.Gui;
@ -18,6 +19,7 @@ import keystrokesmod.module.setting.impl.SliderSetting;
import keystrokesmod.script.Manager;
import keystrokesmod.utility.Utils;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import java.io.File;
import java.io.FileReader;
@ -259,7 +261,9 @@ public class ProfileManager {
Raven.currentProfile = getProfile(name);
}
} catch (Exception e) {
MinecraftForge.EVENT_BUS.post(new PostProfileLoadEvent(Raven.currentProfile.getName()));
}
catch (Exception e) {
failedMessage("load", name);
e.printStackTrace();
}