Crystal optimizer & sprint patch

This commit is contained in:
UnknownUser1789 2023-01-20 22:10:58 +00:00
parent 688c2735ea
commit de513f4329
7 changed files with 29139 additions and 29102 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,15 @@
package dev.resent.module.impl.hud; package dev.resent.module.impl.hud;
import java.util.ArrayList;
import java.util.List;
import dev.resent.module.Theme;
import dev.resent.module.base.Category; import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule; import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting; import dev.resent.module.setting.BooleanSetting;
import dev.resent.util.misc.FuncUtils; import dev.resent.util.misc.FuncUtils;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
import java.util.ArrayList;
import java.util.List;
public class CPS extends RenderModule { public class CPS extends RenderModule {
public CPS() { public CPS() {
@ -39,7 +40,7 @@ public class CPS extends RenderModule {
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time); FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time);
mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, -1, tshadow.getValue()); mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, Theme.getFontColor(Theme.getId()), tshadow.getValue());
} }
} }

View File

@ -1,9 +1,10 @@
package dev.resent.module.impl.movement; package dev.resent.module.impl.movement;
import dev.resent.module.Theme;
import dev.resent.module.base.Category; import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule; import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting; import dev.resent.module.setting.BooleanSetting;
import dev.resent.ui.ClickGUI;
import dev.resent.ui.HUDConfigScreen;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
public class Sprint extends RenderModule { public class Sprint extends RenderModule {
@ -23,24 +24,30 @@ public class Sprint extends RenderModule {
private String getText() { private String getText() {
String text = ""; String text = "";
boolean definitive = false;
if (mc.thePlayer.capabilities.isFlying) { if (mc.thePlayer.capabilities.isFlying) {
text = " [Flying]"; text = " [Flying]";
} }
if (mc.gameSettings.keyBindSprint.isKeyDown()) { if (mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks += 1; keyHeldTicks += 1;
definitive = true;
text = "[Sprinting (Key Held)] "; text = "[Sprinting (Key Held)] ";
} else if (!mc.gameSettings.keyBindSprint.isKeyDown()) { } else if (!mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks = 0; keyHeldTicks = 0;
} }
/*if(keyHeldTicks > 0 && clickDebounce == false) {
toggled = !toggled;
clickDebounce = true;
} else if(clickDebounce == true) {
clickDebounce = false;
}*/
if (keyHeldTicks > 0) { if (keyHeldTicks > 0) {
toggled = !toggled; toggled = !toggled;
} }
if (toggled) { if (toggled) {
if (!mc.thePlayer.isUsingItem()) mc.thePlayer.setSprinting(true); if (mc.thePlayer.movementInput.moveForward == 1 && !mc.thePlayer.isUsingItem()) mc.thePlayer.setSprinting(true);
text = "[Sprinting (Toggled)]"; text = definitive ? text : "[Sprinting (Toggled)]";
} }
lastKeyHeldTicks = keyHeldTicks; lastKeyHeldTicks = keyHeldTicks;
@ -49,14 +56,17 @@ public class Sprint extends RenderModule {
@Override @Override
public int getWidth() { public int getWidth() {
if (mc.currentScreen instanceof HUDConfigScreen || mc.currentScreen instanceof ClickGUI) {
return fr.getStringWidth("[Sprinting [Toggled)]");
} else {
return fr.getStringWidth(getText()); return fr.getStringWidth(getText());
} }
}
@Override @Override
public void draw() { public void draw() {
this.fr = mc.fontRendererObj; this.fr = mc.fontRendererObj;
if (drawn.getValue()) if (drawn.getValue()) fr.drawStringWithShadow(getText(), x + 2, y + 2, -1);
fr.drawStringWithShadow(getText(), x + 2, y + 2, Theme.getFontColor(Theme.getId()));
} }
@Override @Override

View File

@ -331,7 +331,7 @@ public abstract class Entity {
* sets the dead flag. Used when you fall off the bottom of the * sets the dead flag. Used when you fall off the bottom of the
* world. * world.
*/ */
protected void kill() { public void kill() {
this.setDead(); this.setDead();
} }

View File

@ -890,7 +890,7 @@ public abstract class EntityLivingBase extends Entity {
* sets the dead flag. Used when you fall off the bottom of the * sets the dead flag. Used when you fall off the bottom of the
* world. * world.
*/ */
protected void kill() { public void kill() {
this.attackEntityFrom(DamageSource.outOfWorld, 4.0F); this.attackEntityFrom(DamageSource.outOfWorld, 4.0F);
} }

View File

@ -1,12 +1,14 @@
package net.minecraft.entity.player; package net.minecraft.entity.player;
import java.util.Collection;
import java.util.List;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.resent.Resent; import dev.resent.Resent;
import dev.resent.event.impl.Event.EventType; import dev.resent.event.impl.Event.EventType;
import dev.resent.event.impl.EventAttack; import dev.resent.event.impl.EventAttack;
import java.util.Collection;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile; import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -14,6 +16,7 @@ import net.minecraft.block.BlockBed;
import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockDirectional;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.server.CommandBlockLogic; import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
@ -28,6 +31,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.boss.EntityDragonPart; import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.item.EntityBoat; import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
@ -69,7 +73,9 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.FoodStats; import net.minecraft.util.FoodStats;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IInteractionObject; import net.minecraft.world.IInteractionObject;
import net.minecraft.world.LockCode; import net.minecraft.world.LockCode;
@ -989,6 +995,19 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
event.setType(EventType.pre); event.setType(EventType.pre);
Resent.onEvent(event); Resent.onEvent(event);
MovingObjectPosition entityHitResult;
MovingObjectPosition hitResult = Minecraft.getMinecraft().objectMouseOver;
if (hitResult == null) {
return;
}
if (hitResult.typeOfHit == MovingObjectType.ENTITY && (entity = (entityHitResult = (MovingObjectPosition) hitResult).entityHit) instanceof EntityEnderCrystal) {
entity.kill();
entity.setDead();
entity.onKillEntity((EntityLivingBase)entity);
}
if (entity.canAttackWithItem()) { if (entity.canAttackWithItem()) {
if (!entity.hitByEntity(this)) { if (!entity.hitByEntity(this)) {
float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); float f = (float) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();