Skip to content
Merged

Dev #73

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/bypass/Alya.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public String[] initializeModules() {
new Script(Category.EXPLOIT, "pingspoofer"),
new Script(Category.OTHER, "hackerdetector"),
new Script(Category.OTHER, "worldtime"),
new Script(Category.OTHER, "clip"),
new Script(Category.OTHER, "dev")
);
}
Expand Down
59 changes: 58 additions & 1 deletion src/main/java/bypass/lua/api/LuaMinecraftApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.util.*;
import org.jspecify.annotations.NonNull;
import org.luaj.vm2.LuaTable;
Expand Down Expand Up @@ -68,7 +69,7 @@ public static void registerEvents(EventBus eventBus) {
HitboxEvent.class,
event -> {
if(hitboxExpansion >= 0) {
event.setExpansion(hitboxExpansion);
event.setExpansion(event.getExpansion() + hitboxExpansion);
}
});
eventBus.subscribe(
Expand Down Expand Up @@ -234,6 +235,35 @@ public LuaValue call(LuaValue v) {
return LuaValue.NIL;
}
});
set(
"teleport",
new ThreeArgFunction() {
@Override
public LuaValue call(LuaValue xValue, LuaValue yValue, LuaValue zValue) {
if(minecraft.thePlayer == null || minecraft.getNetHandler() == null) {
return LuaValue.NIL;
}
final double targetX = xValue.todouble();
final double targetY = yValue.todouble();
final double targetZ = zValue.todouble();
final double deltaX = targetX - minecraft.thePlayer.posX;
final double deltaY = targetY - minecraft.thePlayer.posY;
final double deltaZ = targetZ - minecraft.thePlayer.posZ;
final double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
final int steps = Math.max(1, (int) Math.ceil(distance / 8.0));
for(int step = 1; step <= steps; step++) {
final double progress = (double) step / steps;
minecraft.getNetHandler().addToSendQueue(
new net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition(
minecraft.thePlayer.posX + deltaX * progress,
minecraft.thePlayer.posY + deltaY * progress,
minecraft.thePlayer.posZ + deltaZ * progress,
false));
}
minecraft.thePlayer.setPosition(targetX, targetY, targetZ);
return LuaValue.NIL;
}
});
set(
"getMotionX",
new ZeroArgFunction() {
Expand Down Expand Up @@ -821,6 +851,16 @@ public LuaValue call() {
return LuaValue.NIL;
}
});
set(
"isCollidedHorizontally",
new ZeroArgFunction() {
@Override
public LuaValue call() {
return minecraft.thePlayer != null
? LuaValue.valueOf(minecraft.thePlayer.isCollidedHorizontally)
: LuaValue.FALSE;
}
});
set(
"isOnEdge",
new ZeroArgFunction() {
Expand Down Expand Up @@ -1145,6 +1185,23 @@ public LuaValue call(LuaValue stateValue) {
return LuaValue.NIL;
}
});
set(
"sendClientStatus",
new OneArgFunction() {
@Override
public LuaValue call(LuaValue statusValue) {
if(minecraft.thePlayer != null && minecraft.getNetHandler() != null) {
String statusName = statusValue.isnil() ? "PERFORM_RESPAWN" : statusValue.tojstring();
C16PacketClientStatus.EnumState state = switch(statusName) {
case "REQUEST_STATS" -> C16PacketClientStatus.EnumState.REQUEST_STATS;
case "OPEN_INVENTORY_ACHIEVEMENT" -> C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT;
default -> C16PacketClientStatus.EnumState.PERFORM_RESPAWN;
};
minecraft.getNetHandler().addToSendQueue(new C16PacketClientStatus(state));
}
return LuaValue.NIL;
}
});
set(
"isOnSolidBlock",
new ZeroArgFunction() {
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/minecraft/client/entity/EntityPlayerSP.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void onUpdateWalkingPlayer() {
if(this.isCurrentViewEntity()) {
motionEvent = new MotionEvent(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround);
Alya.getInstance().getEventBus().dispatch(motionEvent);
final boolean spoofedOnGround = motionEvent.isOnGround();
double d0 = this.posX - this.lastReportedPosX;
double d1 = this.getEntityBoundingBox().minY - this.lastReportedPosY;
double d2 = this.posZ - this.lastReportedPosZ;
Expand All @@ -165,16 +166,16 @@ public void onUpdateWalkingPlayer() {

if(this.ridingEntity == null) {
if(flag2 && flag3) {
this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.rotationYaw, this.rotationPitch, spoofedOnGround));
} else if(flag2) {
this.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.onGround));
this.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.posX, this.getEntityBoundingBox().minY, this.posZ, spoofedOnGround));
} else if(flag3) {
this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, spoofedOnGround));
} else {
this.sendQueue.addToSendQueue(new C03PacketPlayer(this.onGround));
this.sendQueue.addToSendQueue(new C03PacketPlayer(spoofedOnGround));
}
} else {
this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround));
this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, spoofedOnGround));
flag2 = false;
}

Expand Down
129 changes: 79 additions & 50 deletions src/main/java/net/minecraft/client/gui/GuiDownloadTerrain.java
Original file line number Diff line number Diff line change
@@ -1,63 +1,92 @@
package net.minecraft.client.gui;

import java.io.IOException;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.resources.I18n;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.optifine.CustomLoadingScreen;
import net.optifine.CustomLoadingScreens;

import java.io.IOException;

public class GuiDownloadTerrain extends GuiScreen {
private NetHandlerPlayClient netHandlerPlayClient;
private int progress;
private CustomLoadingScreen customLoadingScreen = CustomLoadingScreens.getCustomLoadingScreen();

public GuiDownloadTerrain(NetHandlerPlayClient netHandler) {
this.netHandlerPlayClient = netHandler;
}

/**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl
* Keyboard key code)
*/
protected void keyTyped(char typedChar, int keyCode) throws IOException {}

/**
* Adds the buttons (and other controls) to the screen in question. Called when the gui is
* displayed and when the window resizes, the buttonList is cleared beforehand.
*/
public void initGui() {
this.buttonList.clear();
}

/** Called from the main game loop to update the screen. */
public void updateScreen() {
++this.progress;

if (this.progress % 20 == 0) {
this.netHandlerPlayClient.addToSendQueue(new C00PacketKeepAlive());
private NetHandlerPlayClient netHandlerPlayClient;
private int progress;
private CustomLoadingScreen customLoadingScreen = CustomLoadingScreens.getCustomLoadingScreen();
private GuiButton cancelButton;

public GuiDownloadTerrain(NetHandlerPlayClient netHandler) {
this.netHandlerPlayClient = netHandler;
}

/**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl
* Keyboard key code)
*/
protected void keyTyped(char typedChar, int keyCode) throws IOException {
}

/**
* Adds the buttons (and other controls) to the screen in question. Called when the gui is
* displayed and when the window resizes, the buttonList is cleared beforehand.
*/
public void initGui() {
this.buttonList.clear();
this.cancelButton = new GuiButton(0, this.width / 2 - 100, this.height / 2 + 20, "Cancel");
this.buttonList.add(this.cancelButton);
}

/**
* Called from the main game loop to update the screen.
*/
public void updateScreen() {
++this.progress;

if(this.progress % 20 == 0) {
this.netHandlerPlayClient.addToSendQueue(new C00PacketKeepAlive());
}
}
}

/** Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if (this.customLoadingScreen != null) {
this.customLoadingScreen.drawBackground(this.width, this.height);
} else {
this.drawBackground(0);

protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 0) {
button.enabled = false;
boolean singleplayer = this.mc.isIntegratedServerRunning();

if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
}
this.mc.loadWorld(null);

if(singleplayer) {
this.mc.displayGuiScreen(new GuiMainMenu());
} else {
this.mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
}
}
}

this.drawCenteredString(
I18n.format("multiplayer.downloadingTerrain", new Object[0]),
this.width / 2,
this.height / 2 - 50,
16777215);
super.drawScreen(mouseX, mouseY, partialTicks);
}

/** Returns true if this gui should pause the game when it is displayed in single-player */
public boolean doesGuiPauseGame() {
return false;
}
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if(this.customLoadingScreen != null) {
this.customLoadingScreen.drawBackground(this.width, this.height);
} else {
this.drawBackground(0);
}

this.drawCenteredString(
I18n.format("multiplayer.downloadingTerrain", new Object[0]),
this.width / 2,
this.height / 2,
16777215);
super.drawScreen(mouseX, mouseY, partialTicks);
}

/**
* Returns true if this gui should pause the game when it is displayed in single-player
*/
public boolean doesGuiPauseGame() {
return false;
}
}
53 changes: 26 additions & 27 deletions src/main/java/net/minecraft/client/renderer/EntityRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,85 +358,84 @@ public void getMouseOver(float partialTicks) {
if(entity != null && this.mc.theWorld != null) {
this.mc.mcProfiler.startSection("pick");
this.mc.pointedEntity = null;
double d0 = (double) this.mc.playerController.getBlockReachDistance();
double blockReach = (double) this.mc.playerController.getBlockReachDistance();
this.mc.objectMouseOver = entity.rayTrace(blockReach, partialTicks);
double blockDistance = blockReach;
Vec3 vec3 = entity.getPositionEyes(partialTicks);
boolean flag = false;
int i = 3;

if(this.mc.playerController.extendedReach()) {
d0 = 6.0D;
}

this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks);
double d1 = d0;

final ReachEvent reachEvent = new ReachEvent(d0);
Alya.getInstance().getEventBus().dispatch(reachEvent);
double reachDistance = reachEvent.getReachDistance();
boolean reachModified = reachDistance != d0;
d0 = reachDistance;

if(!this.mc.playerController.extendedReach() && d0 > 3.0D) {
blockReach = 6.0D;
blockDistance = 6.0D;
} else if(blockReach > 3.0D) {
flag = true;
}

if(this.mc.objectMouseOver != null) {
d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3);
blockDistance = this.mc.objectMouseOver.hitVec.distanceTo(vec3);
}

final ReachEvent reachEvent = new ReachEvent(3.0D);
Alya.getInstance().getEventBus().dispatch(reachEvent);
double entityReach = reachEvent.getReachDistance();
if(this.mc.playerController.extendedReach()) {
entityReach = Math.max(entityReach, 6.0D);
}

double searchDistance = Math.max(blockReach, entityReach);
Vec3 vec31 = entity.getLook(partialTicks);
Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
Vec3 vec32 = vec3.addVector(vec31.xCoord * searchDistance, vec31.yCoord * searchDistance, vec31.zCoord * searchDistance);
this.pointedEntity = null;
Vec3 vec33 = null;
float f = 1.0F;
List<Entity> list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double) f, (double) f, (double) f), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>() {
float f = Math.max(1.0F, 1.0F + (float) (entityReach - 3.0D));
List<Entity> list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * searchDistance, vec31.yCoord * searchDistance, vec31.zCoord * searchDistance).expand((double) f, (double) f, (double) f), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>() {
public boolean apply(Entity p_apply_1_) {
return p_apply_1_.canBeCollidedWith();
}
}));
double d2 = d1;
double bestEntityDistance = this.mc.objectMouseOver != null ? blockDistance : searchDistance;

for(Entity value : list) {
float f1 = ((Entity) value).getCollisionBorderSize();
AxisAlignedBB axisalignedbb = ((Entity) value).getEntityBoundingBox().expand((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);

if(axisalignedbb.isVecInside(vec3)) {
if(d2 >= 0.0D) {
if(bestEntityDistance >= 0.0D) {
this.pointedEntity = (Entity) value;
vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
d2 = 0.0D;
bestEntityDistance = 0.0D;
}
} else if(movingobjectposition != null) {
double d3 = vec3.distanceTo(movingobjectposition.hitVec);

if(d3 < d2 || d2 == 0.0D) {
if(d3 < bestEntityDistance || bestEntityDistance == 0.0D) {
boolean flag1 = false;

if(Reflector.ForgeEntity_canRiderInteract.exists()) {
flag1 = Reflector.callBoolean((Entity) value, Reflector.ForgeEntity_canRiderInteract, new Object[0]);
}

if(!flag1 && (Entity) value == entity.ridingEntity) {
if(d2 == 0.0D) {
if(bestEntityDistance == 0.0D) {
this.pointedEntity = (Entity) value;
vec33 = movingobjectposition.hitVec;
}
} else {
this.pointedEntity = (Entity) value;
vec33 = movingobjectposition.hitVec;
d2 = d3;
bestEntityDistance = d3;
}
}
}
}

if(this.pointedEntity != null && flag && vec3.distanceTo(vec33) > (reachModified ? d0 : 3.0D)) {
if(this.pointedEntity != null && flag && vec3.distanceTo(vec33) > entityReach) {
this.pointedEntity = null;
this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing) null, new BlockPos(vec33));
}

if(this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) {
if(this.pointedEntity != null && (bestEntityDistance < blockDistance || this.mc.objectMouseOver == null)) {
this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33);

if(this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) {
Expand Down
Loading
Loading