Fix cps counter & sprint

This commit is contained in:
ThisIsALegitUsername 2023-04-02 00:08:24 +00:00
parent 96679a68e2
commit 4f51539c3b
11 changed files with 54199 additions and 54271 deletions

File diff suppressed because it is too large Load Diff

View File

@ -111,14 +111,6 @@
document.addEventListener("click", () =>{
hasSiteInteractionHappened = true;
});
window.addEventListener('DOMContentLoaded', (event) => {
setTimeout(() => {
if (!tooLate){
document.getElementsByClassName("ratio")[0].className = "ratio show";
}
}, 2000);
});
function setVersion(version){
document.getElementById("clientversion").innerText = version;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,20 @@
package dev.resent.module.impl.hud;
import java.util.ArrayList;
import java.util.List;
import dev.resent.annotation.RenderModule;
import dev.resent.module.base.Mod.Category;
import dev.resent.module.base.RenderMod;
import dev.resent.util.misc.FuncUtils;
import dev.resent.visual.ui.Theme;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.Mouse;
@RenderModule(name = "CPS", category = Category.HUD, x = 4, y = 26)
public class CPS extends RenderMod {
private List<Long> clicks = new ArrayList<>();
private boolean wasPressed;
private long lastPressed;
public boolean wasPressed;
public long lastPressed;
public int getWidth() {
return mc.fontRendererObj.getStringWidth("[CPS: " + clicks.size() + "]") + 4;
@ -24,9 +24,8 @@ public class CPS extends RenderMod {
return mc.fontRendererObj.FONT_HEIGHT + 4;
}
@Override
public void draw() {
boolean pressed = mc.gameSettings.keyBindAttack.pressed || mc.gameSettings.keyBindUseItem.pressed;
boolean pressed = Mouse.isButtonDown(0) || Mouse.isButtonDown(1);
if (pressed != wasPressed) {
lastPressed = System.currentTimeMillis();
@ -37,7 +36,7 @@ public class CPS extends RenderMod {
}
final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicks, aLong -> aLong + 6000 < time);
FuncUtils.removeIf(clicks, sinceLast -> sinceLast + 1000 < time);
drawString("[CPS: " + clicks.size() + "]", this.x + 2, this.y + 2);
}

View File

@ -3,8 +3,14 @@ package dev.resent.module.impl.hud;
import dev.resent.annotation.Module;
import dev.resent.module.base.Mod;
import dev.resent.module.base.Mod.Category;
import dev.resent.module.base.setting.NumberSetting;
@Module(name = "ItemPhysics", category = Category.MISC)
@Module(name = "ItemPhysics", category = Category.MISC, hasSetting = true)
public class ItemPhysics extends Mod{
public static NumberSetting speed = new NumberSetting("Speed", "", 2, 1, 8, 1, 1);
public ItemPhysics(){
addSetting(speed);
}
}

View File

@ -2,61 +2,19 @@ package dev.resent.module.impl.misc;
import dev.resent.annotation.RenderModule;
import dev.resent.module.base.Mod.Category;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import dev.resent.module.base.RenderMod;
import dev.resent.module.base.setting.BooleanSetting;
@RenderModule(name = "ToggleSprint", category = Category.MISC, x = 4, y = 122, hasSetting = true)
public class Sprint extends RenderMod {
public BooleanSetting drawn = new BooleanSetting("Text Drawn", "", true);
public Sprint() {
addSetting(drawn);
public static void onUpdate(){
KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode(), true);
}
public int lastKeyHeldTicks = 0;
public int keyHeldTicks = 0;
public boolean toggled = false;
public boolean clickDebounce = false;
private String getText() {
String text = "";
boolean definitive = false;
if (mc.thePlayer.capabilities.isFlying) {
text = " [Flying]";
public void onDisable() {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), false);
}
if (mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks += 1;
definitive = true;
text = "[Sprinting (Key Held)] ";
} else if (!mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks = 0;
}
if (keyHeldTicks > 0) {
toggled = !toggled;
}
if (toggled) {
if (mc.gameSettings.keyBindForward.pressed && !mc.thePlayer.isUsingItem()) mc.thePlayer.setSprinting(true);
text = definitive ? text : "[Sprinting (Toggled)]";
}
lastKeyHeldTicks = keyHeldTicks;
return text;
}
@Override
public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText());
}
@Override
public void draw() {
if (drawn.getValue()) drawString(getText(), x + 2, y + 2);
}
@Override
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 2;
}
}

View File

@ -1,6 +1,7 @@
package dev.resent.util.physics;
import dev.resent.module.base.ModManager;
import dev.resent.module.impl.hud.ItemPhysics;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@ -58,54 +59,11 @@ public class RenderItemPhysics {
}
if(ModManager.itemPhysics.isEnabled() && !itemIn.onGround) {
float angle = System.currentTimeMillis() % (360 * 20) / (float) (4.5 - 1 /*0.5-4 */);
float angle = System.currentTimeMillis() % (360 * 20) / (float) (4.5 - ItemPhysics.speed.getValue()/2);
GlStateManager.rotate(angle, 1F, 1F, 1F);
}
/*if(Soar.instance.modManager.getModByClass(UHCOverlayMod.class).isEnabled()) {
float ingotScale = 1.5f;
float nuggetScale = 1.5f;
float appleScale = 1.5f;
float oreScale = 1.5f;
float skullScale = 1.5f;
float f6 = -0.0F * (float)(i - 1) * 0.5F;
float f4 = -0.0F * (float)(i - 1) * 0.5F;
float f5 = -0.046875F * (float)(i - 1) * 0.5F;
if(item == Items.gold_ingot) {
if(!ModManager.itemPhysics.isEnabled()) {
GlStateManager.translate(f6, f4 + (ingotScale / 8), f5);
}
GlStateManager.scale(ingotScale, ingotScale, ingotScale);
}
if(item == Items.gold_nugget) {
if(!ModManager.itemPhysics.isEnabled()) {
GlStateManager.translate(f6, f4 + (nuggetScale / 8), f5);
}
GlStateManager.scale(nuggetScale, nuggetScale, nuggetScale);
}
if(item == Items.golden_apple) {
if(!ModManager.itemPhysics.isEnabled()) {
GlStateManager.translate(f6, f4 + (appleScale / 8), f5);
}
GlStateManager.scale(appleScale, appleScale, appleScale);
}
if(block == Blocks.gold_ore) {
if(!ModManager.itemPhysics.isEnabled()) {
GlStateManager.translate(f6, f4 + (oreScale / 8), f5);
}
GlStateManager.scale(oreScale, oreScale, oreScale);
}
if(item == Items.skull) {
if(!ModManager.itemPhysics.isEnabled()) {
GlStateManager.translate(f6, f4 + (skullScale / 8), f5);
}
GlStateManager.scale(skullScale, skullScale, skullScale);
}
}*/
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
return i;

View File

@ -1,6 +1,8 @@
package net.minecraft.client.entity;
import dev.resent.module.base.ModManager;
import dev.resent.module.impl.misc.ParticleMultiplier;
import dev.resent.module.impl.misc.Sprint;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.MovingSoundMinecartRiding;
import net.minecraft.client.audio.PositionedSoundRecord;
@ -133,6 +135,9 @@ public class EntityPlayerSP extends AbstractClientPlayer {
* Called to update the entity's position/logic.
*/
public void onUpdate() {
if(ModManager.sprint.isEnabled()){
Sprint.onUpdate();
}
if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ))) {
super.onUpdate();
if (this.isRiding()) {

View File

@ -303,7 +303,7 @@ public class GuiIngame extends Gui {
}
Resent.INSTANCE.modManager.modules.stream().filter(m -> m.isEnabled() && m instanceof RenderMod).forEach(m -> {
if(!Minecraft.getMinecraft().gameSettings.showDebugInfo){
if(!Minecraft.getMinecraft().gameSettings.showDebugInfo && m.getName() != "CPS"){
((RenderMod) m).draw();
}
});

View File

@ -24,7 +24,10 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_TEXTURE_WR
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import dev.resent.client.Resent;
import dev.resent.module.base.ModManager;
import dev.resent.module.base.RenderMod;
import dev.resent.util.misc.W;
import java.util.List;
import java.util.concurrent.Callable;
@ -882,6 +885,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GlStateManager.enableOverlayFramebufferBlending();
this.mc.ingameGUI.renderGameOverlay(parFloat1);
}
ModManager.cps.draw();
if (framebufferAge == -1l || framebufferAge > (Minecraft.getDebugFPS() < 25 ? 125l : 75l)) {
GlStateManager.disableOverlayFramebufferBlending();
this.overlayFramebuffer.endRender();
}